Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

Command

  • Stable
  • WCAG 2.2 evidence
  • RTL

A one-line shell command with a copy button: the $ prompt, the command in Code/Mono and a copy button that turns into "Copied" for a moment. This is the code-snippet row of the data display set, not the command palette (use CommandPalette for a searchable overlay of actions). The shell is presentational and renders in React Server Components; only the copy button (CommandCopyButton) is a client island. The button is a native-feel React Aria Button: Enter and Space copy, keyboard focus shows the ring, and it is named by copyLabel and described by the command (WCAG 2.1.1, 2.4.7, 4.1.2). The result is announced through React Aria's live region (4.1.3), and the Copied state is the word and a check, not colour alone (1.4.1). The command stays selectable text and wraps at any width (1.4.10). The snippet is always left to right (dir="ltr", as code is) so the prompt, the command and the button keep their order in right-to-left pages; the labels you translate still read in their own direction. Consumer duties: never put secrets in a command that is shown on a page, and translate the three labels.

import { Command } from "@nexera-ui/react";
Loading example…
5
examples
7
props
0
live controls
1
platform
10
WCAG criteria
0
blocks use it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
Generated code
import { Command } from "@nexera-ui/react";

<Command />

Examples 4

The same examples as Storybook, rendered live. Open Code to copy one.

No prompt

prompt={false} hides the $; any other string replaces it. The prompt is never copied.

Loading example…

Long command

A long command wraps and breaks inside long words instead of scrolling, so nothing is cut off at any width.

Loading example…

Right to left

Right-to-left (Arabic): the snippet stays left to right, as code does; only the translated button label is Arabic.

Loading example…

Narrow container

In a narrow container the command wraps under the prompt and the button stays at the end.

Loading example…

Props 7

7 props shown

command*Nexera
string

The command to show and copy. One line of shell: for several lines use a code block. It wraps when the container is narrow.

Default –
promptNexera
string | false

The prompt before the command. Decorative: hidden from assistive technology and not copied. false hides it.

Default $
copyLabelNexera
string

Accessible name of the copy button while it is idle. The command is its description. Translate it for your locale.

Default Copy command
copiedLabelNexera
string

Text of the Copied state: shown beside the check, and announced politely when the command is copied. Translate it for your locale.

Default Copied
copyFailedLabelNexera
string

Announced politely when the browser refuses the copy (no clipboard access). Translate it for your locale.

Default Could not copy
copiedDurationNexera
number

How long the Copied state stays, in milliseconds.

Default 2000
onCopiedNexera
(command: string) => void

Called with the command after it was copied to the clipboard. (Not onCopy: that name is the native clipboard event of the root element.)

Default –

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

WCAG 2.2 evidence

5 direct · 5 supporting
  • 1.1.1Non-text ContentLevel A · tested directly
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.3.2Meaningful SequenceLevel A · supporting test
  • 1.4.10ReflowLevel AA · supporting test
  • 1.4.12Text SpacingLevel AA · supporting test
  • 2.1.1KeyboardLevel A · tested directly
  • 2.4.7Focus VisibleLevel AA · supporting test
  • 2.5.8Target Size (Minimum)Level AA · supporting test
  • 4.1.2Name, Role, ValueLevel A · tested directly
  • 4.1.3Status MessagesLevel AA · tested directly

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

  • data-hovered
  • data-pressed
Usage
<Command className="data-hovered:opacity-90 shadow-sm" />

Used in blocks

No block uses Command yet.

Related components