Flowchart

Use case diagram template (library system)

A use case diagram drawn with flowchart syntax: rectangles for actors, a box for the system boundary and pills for use cases, with include and extend links. Change the text for your requirements document, then export PNG, SVG, Word or PowerPoint free.

Library system

include

include

extend

Reader

Librarian

Search books

Borrow a book

Return a book

Sign in

Pay a late fee

Add books

Manage readers

Previewed in the “Light” theme; you can switch themes in the editor

When to use it

Requirements specifications, the analysis chapter of a thesis and coursework. Mermaid has no dedicated use case syntax, so this uses a flowchart: pills are use cases, a subgraph is the system boundary and actors sit outside it. The result matches a UML use case diagram and only the text needs editing.

Make it yours

  • Actors: rectangle nodes such as R[Reader], one per role, outside the subgraph.
  • Use cases: each line inside the subgraph, phrased as verb plus noun, such as "Borrow a book".
  • Connect an actor to a use case with ---, which has no arrowhead.
  • Write include as A -. include .-> B (doing A always involves B) and extend as C -. extend .-> A (C happens only under a condition).
  • Actors are rectangles and use cases are pills, so the two are easy to tell apart; Mermaid cannot draw the UML stick figure.

Mermaid code

use-case-diagram.mmd
flowchart LR
    R[Reader]
    L[Librarian]
    subgraph SYS[Library system]
        U1([Search books])
        U2([Borrow a book])
        U3([Return a book])
        U4([Sign in])
        U5([Pay a late fee])
        U6([Add books])
        U7([Manage readers])
    end
    R --- U1
    R --- U2
    R --- U3
    U6 --- L
    U7 --- L
    U2 -. include .-> U4
    U3 -. include .-> U4
    U5 -. extend .-> U3

Ask an AI for one with this structure

Send the prompt below to ChatGPT or Claude, then paste the whole reply into the editor; the code inside is detected automatically.

prompt.txt
Draw a use case diagram with Mermaid flowchart LR syntax. The system is a library system and the actors are Reader and Librarian, written as rectangle nodes such as R[Reader] outside the subgraph. Put the use cases in a subgraph named "Library system", also as pills ([Text]): search books, borrow a book, return a book, sign in, pay a late fee, add books and manage readers. Connect actors to use cases with ---; write include as A -. include .-> B and extend as C -. extend .-> A. Output only the mermaid code block.

FAQ

Can Mermaid draw a use case diagram?

Mermaid has no dedicated use case diagram type at the moment. Pill-shaped flowchart nodes for use cases and a subgraph for the system boundary give the same structure; this template is drawn that way and renders and exports normally.

What is the difference between include and extend?

Include means the base use case always uses the included one: borrowing a book always requires signing in. Extend is optional behavior under a condition: a late fee is paid only when a return is overdue. The include arrow points from the base use case to the included one, and the extend arrow points from the extension to the base use case.

How detailed should a use case diagram be?

One diagram per subsystem, with ten use cases or fewer. A use case is one complete thing a user can get done. Steps such as clicking a button or filling in a form are not use cases and belong in a flowchart or the use case description.

More in this category

All templates

Updated 2026-11-11