Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

No Roles Empty State Block for React

An access-management tool's first-role page: a name field, five permission switches, a sentence that rewrites itself, and a key ring whose next free tag is dashed and shows the role you are building.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Turn the first role into something you build, with this no roles empty state for React with Base UI. A whole screen, split in two by a hairline band across it with a plus mark where it meets each rail. At the start sit the heading, a name Input in a Field, five Switches for what the role can do (view, comment, edit, delete, invite) and one sentence that rewrites itself as you flip them, such as "Editor can view, comment and edit. Cannot delete or invite." The Shine Button creates the role and is the only colored control. At the end a key ring hangs three tags, drawn in one line weight: the next free tag is dashed and carries the name and permission count of the role you are building, live; creating it turns the tag solid and adds a Badge chip under the form. Three roles fit and Start over puts them back. The band is ruled by Guides, the key ring is one SVG that changes by class, and the entrance is CSS only. For the roles page of any admin or access tool.

FAQ

What stays in the page, and how do I make it real?

The roles live in the page's state: reload and the key ring is bare, and Start over bares it without a reload. Nothing is saved or sent. To wire it for real, post the name and the permission ids to your API where the code says so, then add the role from the response, and load the existing roles into the same list and key ring.

How is the sentence built?

From the switches alone: the permissions that are on are joined with "and" after "can", the ones that are off with "or" after "Cannot", and the two special cases, nothing on and everything on, have their own wording. It is plain text in the page, tied to the Create role button as its description, so it reads when you reach the button, and it never speaks while you flip switches.

What does the name field refuse?

An empty name, and a name a role already has, ignoring case. The reason shows in a line under the field that holds its space, so the layout never moves, and focus goes back to the field. The button stays in the tab order and says why instead of doing nothing; with three roles made it tells you to start over, since the demo holds three.

Is the key ring accessible?

It is decoration, hidden from assistive technology: the same facts are in the form's sentence, the chips under it and the one polite status line, which says each change ("Created Editor with 3 of 5 permissions in this demo"). The words on the tags are HTML laid over the drawing, not SVG text, so they follow the page's font and language.

Why does each switch have a long name?

So a screen reader hears what it grants, such as "Delete: Remove a project for good", while the visible row keeps the short word and its hint. The pressed tone is the foreground color, never the primary, so the Shine Button stays the one colored control.

How does it look on a phone?

The key ring comes first, 140 px tall, then the heading and the form. Create role pins to the foot of the screen so it is always within reach however long the switch list is, and the hints under each switch drop so five rows fit. Nothing scrolls sideways at 320 px.

  • Pro

    An access-control tool's empty rules page: a preset strip over a real matrix of checkboxes (Projects, Docs and Billing by Create, Read, Update and Delete), a count, a Save rules foot, and a garden gate that opens as you allow more.

  • Pro

    No Guests Empty State

    Team and access

    A collaboration tool's empty guest list: a pass to fill in (email, how long it lasts, view or comment), a visitor badge on a lanyard that fills as you type, a summary that rewrites itself, and a guest list of three dashed places.

  • Pro

    Permissions Account

    Shared access

    A read-only matrix of what each role may do: permissions in four folding groups against four roles with counts, your own role framed and marked You, and a Request button on what it lacks.

  • Pro

    A compliance tool's empty ledger: retention policy radio cards beside a vault door whose dial turns to the choice, and an empty table of Time, Actor, Action and Resource whose first row is written when the policy is saved.

  • Pro

    A contacts book's empty state with two tabs: Add one, a name, email and company form, and Import CSV, a drop zone that reads the file's header in your browser; one button for the active tab and an address-card tray whose dashed place turns solid.

  • Pro

    An org-chart tool's empty departments page: a dashed chart of a root and two children, an Add department button that turns the root into a name field, sub-departments joined by CSS lines, and Remove for a box with no children.