Row
Row is one line in a list that people pick from, such as search results or a settings list.
Use a Row for one line in a list that people pick from, such as search results, a list of commands, a settings list or a list of files. It looks and behaves like a menu item or a sidebar item. To build the list, put the Rows in a Stack.
Inside a Menu, use MenuItem instead. To let someone choose one option from several as a form value, use a RadioGroup. The current prop only marks the page or file that is open now: it highlights the Row and sets aria-current.
A Row is as tall as a Button at the same size, so it lines up with the Buttons around it. Put an icon, an avatar or a tick in leading, and a count, a shortcut or a chevron in trailing.
A Row renders as a button by default. Pass render={<a href="ā¦" />} for a Row that goes to another page, or render={<div />} for a Row that only shows information. Set disabled to keep a Row visible while it is unavailable, and tone="destructive" for the one action that deletes something.
By default a Row lights up when the pointer is over it. When your list moves a highlight with the arrow keys, pass highlighted to every Row, even when it is false. The Rows then light up only when highlighted is true and ignore the pointer.
A Row has no keyboard behaviour of its own. Your list sets the role, such as listbox or list, and handles the keys, because only the list knows what its Rows mean.
Props
Generated from the types. It lists what this component DECLARES: a prop that arrives from a shared type or from the platform is real and is not repeated here.
| Prop | Type | What it does |
|---|---|---|
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
current? | boolean | Marks the row as the current location, such as the page you are on or the open file. |
disabled? | boolean | Disables the row. |
highlighted? | boolean | Highlights the row from your code. |
leading? | React.ReactNode | Content before the label, such as an icon, an avatar or a tick. |
render? | RenderElement | Renders the row as a different element. |
size? | "1" | "2" | "3" | "4" | Sets the height of the row. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
tone? | "neutral" | "accent" | "destructive" | "blue" | "green" | "orange" | "amber" | "pink" | "purple" | "success" | "warning" | "info" | Sets the colour family of the row. |
trailing? | React.ReactNode | Content at the far end of the row, such as a shortcut, a count or a chevron. |
It also takes every prop of a <button>.
emphasisā The Rows in a list are equals, so none of them should look more important than the others. Usetone="destructive"for the one row that deletes something.- A keyboard model ā Only your list knows how its rows should be navigated. Handle the keys in the list and pass
highlightedto show which row is active. - A
selectedprop ā Choosing one option from several is a form value, so use a RadioGroup for it. Usecurrentto mark the page or file that is open. - A List component ā Use a Stack to arrange the rows, and set the list's role yourself, because the right role depends on what the rows mean.
- The shorter height of a menu row ā A Row sits next to ordinary Buttons, so it matches their height. The shorter rows belong to menus, which are only open for a moment, so use a Menu when you want them.