Skip to content

Behaviour rules and guidelines

79 rules and 23 guidelines. A rule is decided by WCAG 2.2 or by the judges. A guideline is our own choice, where the judges are split or too few have spoken. How the method works

New to the rules? Start with what shadcn and Radix handle and what they leave to you, or read why AI coding agents need rules like these.

Actions

11 rules and 4 guidelines. Accessible button patterns for shadcn: what the area covers and how its rules fit together.

RuleLevelVerdictStatus
ACT-001a Start an action button with a verb that names the actionRuleUnanimous (3 of 3)decided
ACT-001b Give every button an accessible name that says what it does and contains its visible textRuleRequirementdecided
ACT-002a Give at most one button in a group the most emphasised styleRuleUnanimous (3 of 3)decided
ACT-002b Use at most one primary button on a pageRuleMajority (2 of 3)decided
ACT-003a Put the confirming button last in a dialog's row of buttonsRuleUnanimous (3 of 3)decided
ACT-003b Put a page's buttons in the part they act on and keep them in the same placeRuleUnanimous (3 of 3)decided
ACT-004 Keep the submit button enabled on a form that does not fit on one screenGuideline, our choiceSplit (1 of 2)decided
ACT-005 Say next to an unavailable submit button what is still neededRuleUnanimous (2 of 2)decided
ACT-006 Make every pointer target at least 24 by 24 pixels, or pass the 24-pixel spacing testRuleRequirementdecided
ACT-007a Offer a way without dragging for everything people can dragRuleRequirementproposed
ACT-007b Tell assistive technology what each step of a keyboard move didGuideline, our choiceInsufficient evidence (0 of 3 judges spoke)proposed
ACT-008 Mark where a dragged item would land, and only while it is over that placeRuleUnanimous (2 of 2)proposed
ACT-009 Give everything people click to go somewhere or to act the role of a control in codeRuleRequirementproposed
ACT-009a Build a control that only takes people somewhere as a link, also when it looks like a buttonGuideline, our choiceInsufficient evidence (1 of 3 judges spoke)proposed
ACT-009b Build a control that acts where the person is as a button, also when it looks like a linkGuideline, our choiceInsufficient evidence (1 of 3 judges spoke)proposed

Colour and motion

11 rules and 0 guidelines. Colour contrast and motion patterns for shadcn: what the area covers and how its rules fit together.

RuleLevelVerdictStatus
VIS-001 Give text at least 4.5:1 contrast against the colour it is actually drawn onRuleRequirementproposed
VIS-002 Use each colour token only for the role and the pairs it was made forRuleUnanimous (3 of 3)proposed
VIS-003a Never let colour be the only sign of what something means or which state it is inRuleRequirementproposed
VIS-003b Make a link in running text stand out from the words around it by more than colourRuleRequirementproposed
VIS-004 Give the edges and state marks of controls, and the parts of graphics people need, 3:1 contrastRuleRequirementproposed
VIS-005 Let people pause, stop or hide content that moves or updates by itselfRuleRequirementproposed
VIS-006 Swap movement for a fade or no motion when the person asks for reduced motionRuleUnanimous (3 of 3)proposed
VIS-007 Never let motion be the only sign of what happenedRuleUnanimous (2 of 2)proposed
VIS-008 Show a change on everything people can press, while it is pressed and while the pointer is over itRuleUnanimous (3 of 3)proposed
VIS-008a Set every state a control shows in code on the control, and change it whenever the look changesRuleRequirementproposed
VIS-008b Keep a selected or on state visible while the item is hovered, focused or pressedRuleUnanimous (3 of 3)proposed

Destructive actions

2 rules and 0 guidelines. Delete confirmation and undo patterns for shadcn: what the area covers and how its rules fit together.

RuleLevelVerdictStatus
DST-001a Make destructive actions reversible, and offer Undo instead of asking firstRuleUnanimous (2 of 2)decided
DST-001b Ask before an action only when it cannot be reversed or a mistake would cost a lotRuleUnanimous (3 of 3)decided

Dialogs

5 rules and 2 guidelines. Accessible dialog patterns for shadcn: what the area covers and how its rules fit together.

RuleLevelVerdictStatus
DLG-001 Let Escape do what Cancel does in a dialogRuleUnanimous (3 of 3)decided
DLG-002 Keep one dialog open at a timeRuleUnanimous (2 of 2)decided
DLG-003 Name the action on the destructive button and always offer CancelRuleUnanimous (3 of 3)decided
DLG-004 Never make the destructive button the default in a confirmation dialogGuideline, our choiceSplit (1 of 2)decided
DLG-005 Give the destructive button the danger style, also when the person asked for the actionGuideline, our choiceSplit (1 of 2)decided
DLG-006 Move focus into a modal dialog when it opens and back to its opener when it closesRuleRequirementproposed
DLG-007 Keep Tab inside a modal dialog and the page behind it out of useRuleUnanimous (2 of 2)proposed

Feedback

4 rules and 0 guidelines. Toast and status message patterns for shadcn: what the area covers and how its rules fit together.

RuleLevelVerdictStatus
FBK-002 Show a failed action where it started and keep it thereRuleUnanimous (3 of 3)decided
FBK-003 Show a successful result in the view, not only in a toast that disappearsRuleUnanimous (3 of 3)decided
FBK-004 Announce a status message without moving focusRuleRequirementdecided
FBK-005 Give a toast at most one action, keep it until it is used, and offer that action elsewhere tooRuleUnanimous (2 of 2)decided

Forms

15 rules and 12 guidelines. Accessible form patterns for shadcn: what the area covers and how its rules fit together.

RuleLevelVerdictStatus
FRM-001 Give every form control a visible labelRuleMajority (2 of 3)decided
FRM-002a Show a field's error as text at the fieldRuleUnanimous (2 of 2)decided
FRM-002b Show a field's error when the person leaves the field or sends the form, and clear it as soon as the value is validRuleUnanimous (2 of 2)decided
FRM-003 Give every form in a dialog a Cancel that always works and changes nothingRuleUnanimous (3 of 3)decided
FRM-004a Ask before a full-screen dialog throws away unsaved changes, and only when something would be lostRuleUnanimous (2 of 2)decided
FRM-004b Ask before a dialog or sheet that does not fill the screen throws away unsaved changes, and only when something would be lostGuideline, our choiceInsufficient evidence (1 of 3 judges spoke)proposed
FRM-004c Ask before leaving a page throws away unsaved changes, and only when something would be lostGuideline, our choiceInsufficient evidence (1 of 3 judges spoke)proposed
FRM-004d Keep what people enter in a longer page form when they leave, and show that it is keptGuideline, our choiceInsufficient evidence (1 of 3 judges spoke)proposed
FRM-005 Mark required or optional fields one way, in the label, with any symbol explainedRuleUnanimous (2 of 2)decided
FRM-007 Give fields for the person's own details the matching autocomplete valueRuleRequirementdecided
FRM-008 Let people sign in with paste, a password manager or a route with no testRuleRequirementdecided
FRM-009 Fill in or offer what the person already gave earlier in the same processRuleRequirementdecided
FRM-010 Give every form control a name in code that contains its visible labelRuleRequirementproposed
FRM-011 When a form is sent with problems, move focus to the first problem or to a summary of themGuideline, our choiceInsufficient evidence (0 of 3 judges spoke)proposed
FRM-012a Changing a value does not send a form, open a page or move focus unless people were told firstRuleRequirementproposed
FRM-012b Let a control that holds a choice only record it, and put actions on buttons and links, even with a noticeRuleMajority (2 of 3)proposed
FRM-013 Receiving focus never sends a form, opens a page, a window or a dialog that takes focus, or moves focus onRuleRequirementproposed
FRM-014 Give email, phone and web address fields the input type that matches the valueGuideline, our choiceInsufficient evidence (1 of 3 judges spoke)proposed
FRM-014a Give a text field that takes only digits the digit keypad with inputmodeGuideline, our choiceInsufficient evidence (1 of 3 judges spoke)proposed
FRM-014b Put a string of digits that is not a quantity in a text input, never a number inputGuideline, our choiceInsufficient evidence (1 of 3 judges spoke)proposed
FRM-015 Let Enter in a single-line field send the form, as its main button doesRuleUnanimous (3 of 3)proposed
FRM-016a Let a click on a checkbox's or radio button's text change it, as a click on the box doesRuleUnanimous (2 of 2)proposed
FRM-016b Let a click on a switch's text turn it on or off, as a click on the switch doesGuideline, our choiceInsufficient evidence (1 of 3 judges spoke)proposed
FRM-017 Let every text field take a pasted value, and never cut it without saying soGuideline, our choiceInsufficient evidence (0 of 3 judges spoke)proposed
FRM-017a Accept the spaces and separators people write in a number or code, and remove them before checkingGuideline, our choiceInsufficient evidence (0 of 3 judges spoke)proposed
FRM-017b State a free-text field's length limit and show how much is usedGuideline, our choiceInsufficient evidence (1 of 3 judges spoke)proposed
FRM-017c Say in words when a free-text limit is reached, and never cut text in silenceGuideline, our choiceInsufficient evidence (1 of 3 judges spoke)proposed

Keyboard

5 rules and 0 guidelines. Keyboard and focus patterns for shadcn: what the area covers and how its rules fit together.

RuleLevelVerdictStatus
KBD-001 Let the keyboard do everything the pointer can, and show where focus isRuleRequirementdecided
KBD-002 Keep the focused element at least partly in viewRuleRequirementdecided
KBD-003 Let people turn off or change a shortcut made only of character keysRuleRequirementproposed
KBD-003a Show every shortcut the product adds, beside its command or in one listRuleUnanimous (2 of 2)proposed
KBD-003b Build a shortcut on a modifier key by defaultRuleUnanimous (2 of 2)proposed

Layout

4 rules and 0 guidelines. Responsive layout and reading order for shadcn: what the area covers and how its rules fit together.

RuleLevelVerdictStatus
LAY-001 Let the page fit a 320-pixel viewport without scrolling sidewaysRuleRequirementdecided
LAY-002 Keep the order in the code telling the same story as the order on screenRuleRequirementdecided
LAY-003a Let text grow to 200 percent without losing content or functionRuleRequirementproposed
LAY-003b Keep all text and functions intact when people widen the text spacingRuleRequirementproposed

3 rules and 1 guideline. Navigation menu patterns for shadcn: what the area covers and how its rules fit together.

RuleLevelVerdictStatus
NAV-002a When a menu shows the current page, say so in the code on that itemRuleRequirementproposed
NAV-002b Mark the current page in a repeated menu with a cue that is not colour aloneRuleUnanimous (2 of 2)proposed
NAV-003 Keep repeated navigation in the same order on every pageRuleRequirementproposed
NAV-004 Start a page with a skip link when links come before its main contentGuideline, our choiceInsufficient evidence (1 of 3 judges spoke)proposed

Page structure

7 rules and 1 guideline. Page structure patterns for shadcn: what the area covers and how its rules fit together.

RuleLevelVerdictStatus
STR-001 Give every page a title that says what it is for, and change it with every viewRuleRequirementproposed
STR-002a Mark text that heads a part of the view as a heading in codeRuleRequirementproposed
STR-002b Word each heading so it says what the part below it holdsRuleRequirementproposed
STR-003 Give each view one h1 and every other heading the level its place in the outline gives itGuideline, our choiceInsufficient evidence (1 of 3 judges spoke)proposed
STR-004 Build the page's regions from landmark elements, and name repeated ones apartRuleUnanimous (2 of 2)proposed
STR-005 Give images and icons that carry information a text alternative, and hide the ones that only decorateRuleRequirementproposed
STR-006 Name the page's main language in the lang attribute on the html element, and change it when the interface changes languageRuleRequirementproposed
STR-006a Mark text in another language than the text around it with its own lang attributeRuleRequirementproposed

States

5 rules and 2 guidelines. Loading and empty state patterns for shadcn: what the area covers and how its rules fit together.

RuleLevelVerdictStatus
STA-001 Show a wait in the part that is loading, not over the whole pageRuleUnanimous (3 of 3)decided
STA-002a Say what will appear in a space that holds nothing yet, and offer the first stepRuleUnanimous (2 of 2)proposed
STA-002b Never say a space is empty while its content is still loadingRuleUnanimous (2 of 2)proposed
STA-003 When a search or filter matches nothing, say so and offer a way to change itGuideline, our choiceInsufficient evidence (1 of 3 judges spoke)proposed
STA-004 Let people turn off, lengthen or extend a time limit the product setsRuleRequirementdecided
STA-005a Show that a sent action is under way until the reply comesRuleUnanimous (3 of 3)proposed
STA-005b While an action is being sent, a second press does not send it againGuideline, our choiceInsufficient evidence (1 of 3 judges spoke)proposed

Tables

3 rules and 1 guideline. Accessible data table patterns for shadcn: what the area covers and how its rules fit together.

RuleLevelVerdictStatus
TBL-001 Build data in rows and columns as a table in code, with its headings marked as headersRuleRequirementproposed
TBL-002 Put a keyboard sort control in a sortable header, and expose its order in codeRuleRequirementproposed
TBL-003 Give every row action its own control the keyboard reaches, and show hidden actions on focusRuleRequirementproposed
TBL-004 Give every data table a visible title and tie it to the table in codeGuideline, our choiceInsufficient evidence (1 of 3 judges spoke)proposed

Text

4 rules and 0 guidelines. Error, tooltip and link text patterns for shadcn: what the area covers and how its rules fit together.

RuleLevelVerdictStatus
TXT-001a Say what went wrong, what it concerns and what to do nextRuleUnanimous (3 of 3)decided
TXT-002a Let people close, hover and keep content that appears on hover or focusRuleRequirementdecided
TXT-002b Open tooltips on focus too, and keep what people need on the pageRuleUnanimous (2 of 2)decided
TXT-003 Make every link's destination clear from its text, its name or the sentence it sits inRuleRequirementdecided