The teacher's list of a class: search, today's attendance in one press, the average so far and when each student was last active.
Used for
- A teacher's start-of-lesson screen
- Taking attendance
- Finding who has gone quiet
Examples
Installation
npx knowns-ui@latest add class-rosterFor Claude Code, Cursor or Codex: installs it and wires the props to your own data.
Paste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install prompt
Install Class roster from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/class-roster
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add class-roster
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/use-floating.ts
- components/ui/knowns/tooltip.tsx
- components/ui/knowns/tooltip-utils.ts
- components/ui/knowns/avatar.tsx
- components/ui/knowns/badge.tsx
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- lib/knowns/quiz.ts
- components/ui/knowns/blocks/education/class-core.ts
- components/ui/knowns/calendar/calendar.tsx
- components/ui/knowns/calendar/calendar-utils.ts
- components/ui/knowns/calendar/calendar-zone.ts
- components/ui/knowns/checkbox.tsx
- components/ui/knowns/field-class.ts
- components/ui/knowns/popover.tsx
- components/ui/knowns/date-range-picker.tsx
- components/ui/knowns/kbd.tsx
- components/ui/knowns/textarea.tsx
- components/ui/knowns/chat-composer/use-autosize.ts
- components/ui/knowns/input.tsx
- components/ui/knowns/menu.tsx
- components/ui/knowns/segmented-control.tsx
- components/ui/knowns/skeleton.tsx
- components/ui/knowns/slider.tsx
- components/ui/knowns/data-table/data-table.tsx
- components/ui/knowns/data-table/data-table-action-bar.tsx
- components/ui/knowns/data-table/data-table-filters.tsx
- components/ui/knowns/data-table/table-filters.ts
- components/ui/knowns/data-table/table-utils.ts
- components/ui/knowns/blocks/education/class-roster.tsx
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0, class-variance-authority@^0.7.1.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/class-roster, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "class-roster" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- students
RosterStudent[]- id, name, and optionally email, lastActiveMs and average (0 to 100).
- attendance
Record<string, Attendance>- Today's status by student id. A student with none shows Not marked.
- onAttendanceChange
(id, next) => void- Fired when the chip is pressed with the next status. Leave it out for a read-only chip.
- onSelectStudent
(id) => void- Makes rows clickable.
- onMarkAllPresent
() => void- Shows Mark all present while anyone is unmarked.
- now
number- Default
real time - The clock for the last-active column. Pass a fixed value in tests and docs.
- pageSize
number|false- Default
false - Rows per page, or one scrolling list.
| Prop | Type | Default | Description |
|---|---|---|---|
| students | RosterStudent[] | - | id, name, and optionally email, lastActiveMs and average (0 to 100). |
| attendance | Record<string, Attendance> | - | Today's status by student id. A student with none shows Not marked. |
| onAttendanceChange | (id, next) => void | - | Fired when the chip is pressed with the next status. Leave it out for a read-only chip. |
| onSelectStudent | (id) => void | - | Makes rows clickable. |
| onMarkAllPresent | () => void | - | Shows Mark all present while anyone is unmarked. |
| now | number | real time | The clock for the last-active column. Pass a fixed value in tests and docs. |
| pageSize | number | false | false | Rows per page, or one scrolling list. |
What it handles
- 01Searches by name or email as you type, and sorts by any column.
- 02Cycles today's status with one press: Present, Late, Absent, Excused. The summary line counts the room as it changes.
- 03Shows the running average and when each student was last active, as words that stay correct while the page is open.
- 04Marks every student who is not marked yet as present in one press.
- 05Builds on the data table, so keyboard, sorting and long lists work the same way.
States
- Status pressed
- The chip changes colour and the room count ticks
- 120ms, ease-out
- Search typed
- Rows that do not match leave at once
- 0ms
- Reduced motion
- Colours change with no fade
- 0ms
| State | What moves | Timing |
|---|---|---|
| Status pressed | The chip changes colour and the room count ticks | 120ms, ease-out |
| Search typed | Rows that do not match leave at once | 0ms |
| Reduced motion | Colours change with no fade | 0ms |
Works with
When to use
When to use
- The start of a lesson: who is here, who is late, who has gone quiet.
- A class list that opens a student when a row is clicked.
When not to use
- Entering or reading scores: use Gradebook.
- A table of anything else: use Data Table.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Class Roster to my app and wire it to my own data.
- I need the start of a lesson: who is here, who is late, who has gone quiet. Set that up with the Knowns UI Class Roster.
- Which Class Roster props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "class-roster" }) and search_docs({ query: "class roster" }).