Components · Actions
Button
A button for an action, with or without a label; its color says what kind of action it is, and its size follows where it sits.
import { Button } from "@botiverse/raft-ui";A button starts an action. Its color says what kind of action it is: pink for the one action a screen exists for, an ink border for the rest, no frame for cancel and minor actions, orange for what interrupts and red for what cannot be undone. An icon-only button is the same component at an icon size.
When to use
Variants
accent renders the same as primary, and outline, information, muted and success the same as default. Use the names in the table.
On the frame, a button takes the frame's ink (foreground-on-frame) and lays fill-frame-medium over itself on hover, on press and while its popup is open. The text and icon sizes become the frame item (frame-item-height: 34px with a mouse, the control height, and 36px on a touch screen).
Which color
Emphasis is relative to the surface that holds the button, not a property of the action. A frameless Cancel reads as a control inside a dialog and as a line of text on a page; the action did not change, what encloses it did. The test is whether the surface draws its own edge and takes focus while it is open — a dialog, a sheet, a menu, a popover, a toolbar, a card, a panel header all do; a page and a section of a page do not. When a surface is not on that list, apply the test rather than guessing: if the button would be the only thing marking where it sits, give it a border.
Every button is flat: the ink border or the sticker marks it as a control, never a shadow (Elevation). Colored buttons carry ink type (Color).
- Make the primary action pink. Use at most one pink button per screen; a screen may have none. Unread counts and attention dots don't count toward the one. The one exception is a tour's coach mark, whose Next sits over a live page that keeps its own pink button (Coach marks).
- When a screen has a second primary action, make it
default. - Give every other action an ink border (
default). - Make cancel and minor actions frameless (
ghost) inside a surface that draws its own edge. On a page, give the same action an ink border (default). - When buttons stack full width (a dialog footer whose row doesn't fit, a bottom sheet's actions), a
ghostbutton there takes the ink border ofdefault, with its hover and press. Stretched to the full width, a frameless button reads as a line of text, not a button: once buttons stack, each needs its own box (stdrc, 2026-10-22). The container marks the stack withdata-stacked; the button keeps itsghostvariant and loses the frame again when the row comes back. Disabled, it keeps the disabled fill; an icon button stays frameless. - Use TextLink for the bottom of the ladder: where even a frameless button is too much weight, such as Forgot password on a sign-in page or a See all beside a section title. It may carry an action, but it is the quietest control on the screen, never a way to fit one more button into a crowded row. It is not a Button variant: a text link is a word in a line, not a box, so it takes the size of the text around it, and a Button would bring a height, a border and padding that each have to be taken off again.
- Use orange (
warning) for actions that interrupt but can be undone: stop, leave, reset. - Use red (
danger) only for actions that cannot be undone, and only in a confirmation dialog (a Dialog atsize="sm", or an AlertDialog where the product lists one). Don't color a destructive item in a menu (DropdownMenu). - Don't use
danger-secondaryordanger-outline: red text on an outline button puts red outside a confirmation dialog. - Never make a button yellow: yellow means "you" (Color).
Sizes
Size follows the purpose. The same purpose has the same size everywhere, and there are no other sizes. lg, icon-lg and xl take the control height (Spacing): a finger's size on a phone and a touch screen, and Feishu's PC sizes on a desktop (from 768px with a mouse or trackpad). On a desktop lg is as tall as md, with its wider padding and its text-subhead label. Still pick lg by purpose, as the table says: the same code runs on a phone, where lg is the finger-sized button the purpose needs, and on a desktop it costs nothing in height.
These three and the three icon sizes, icon-sm, icon-md and icon-lg (Icon buttons), are all the sizes. xs and sm render exactly as md, and icon-xs exactly as icon-md. They are deprecated aliases, kept until raft-ui 1.0. node node_modules/@botiverse/raft-ui/codemods/button-sizes.mjs <src> renames them, and nothing on screen changes. icon-sm was one of these aliases until it became the 28px row action; the codemod leaves it alone.
When a place looks too tight for a 32px button, change the container, not the button. A banner's button is md at every banner size, and the banner's text is as large as its label (Banner).
Size by place
Every place has one answer. Where a part of the container sets the place, follow it: the size comes with the place, not with the button.
Inside a floating toolbar
A toolbar that floats over content shows on every message under the pointer, so it is more compact than the page. The message hover toolbar and the text-selection toolbar are 36px high on a touch screen, with 28px buttons at radius-chip, and 42px high with a mouse, with buttons at the control height (34px) and radius-control, like every desktop control (stdrc, 2026-11-05); the buttons sit 4px from the frame and 4px apart. The container sizes them: MessageItemToolbarButton and TextSelectionToolbarButton are the toolbars' own parts. The toolbar for selected items is not one of these: with a mouse its buttons are md ghost Buttons at their own 34px, with a 16px icon; by touch they are 44px bar buttons with a head's 22px icon, as a head's (SelectionToolbar). Don't size a Button 28px with a class: a 28px icon-only action on a line of a row or a card is icon-sm (Row actions), and a floating toolbar's 28px button by touch is the toolbar's own part, not icon-sm. SidebarSectionControl, on a sidebar section's header line, is smaller still: 24px with a 14px icon (Sidebar).
Icon buttons
- Make an icon button next to an input (copy a link, remove a row) the input's height:
size="icon-lg", which follows the field's height on a phone and on a desktop. - Put several icon buttons in a panel header inside
PanelActions(Panel), which aligns them to the end and spaces them. - Mark a bell that has something new with an attention dot on its top-right corner.
- Count the send button as the screen's pink button.
Icon sizes by context are in Iconography.
Row actions
An action on one line of a row or a card, such as the More (⋮) at the end of a comment's author line or the trailing action of a list row, is icon-sm: a 28px square (row-action-size, the bar button's size with a mouse) with a 16px icon at radius-chip. A line of text is 18 to 22px tall, so a 34px button would push the line apart and outweigh the name beside it; at 28px the action sits inside the line's rhythm (Hit targets).
- Make it
ghost. It sits on a row or a card that draws its own edge, often revealed on hover (Lists). - It stays 28px on a touch screen too, and its hit area reaches 44px with every pointer through a transparent
::afterthat overhangs by 8px on each side, plus its 1.5px border. Its target reaches 8px past its box on each side, so two row actions side by side would cover each other's: put at most one row action on a line, at its end, and put any second action in its More (⋮), as a comment card does. A line's end holds one secondary action; more than one is the density we don't want there. - Don't use it in a toolbar, a filter bar, a panel header or a composer: those are
icon-mdor the bar's own buttons, so a bar keeps one size. Nor on the frame:on-frametakesicon-md.
Split buttons
When one action is what most people want and a short menu holds other ways to reach the same result, such as Create agent and its ▾ (Take over a local session, Connect an external agent) on Raft Chat's Members header, the button comes in two parts that read as one: ButtonSplit holds a ButtonSplitMain, the action, and a ButtonSplitMenu, the narrow chevron that opens the menu. Render the menu part as the trigger of a DropdownMenu: <DropdownMenuTrigger render={<ButtonSplitMenu aria-label="More ways to create an agent" />} />. Work in progress: import the parts from @botiverse/raft-ui/wip.
- When. Use a split when the main action is the usual one and the menu holds a few others. When the choices weigh the same, use one Button that opens a DropdownMenu; when they do different things, use separate buttons.
- Variant and size. Give both parts the same
variantandsize, as a Button takes them:primaryordefault,mdorlg.warninganddangersplit the same way, used only where their own rules allow those colors (Which color); a destructive action is rarely the usual one with others beside it. The frameless split isPanelSplitAction, for a panel header (Split actions); there is noghostsplit button. - One shape. The two parts touch, with no gap, and together are one
radius-controlshape: the main part is rounded only on its start side, the menu part only on its end side, and both are the Button size's height. The menu part is 28px wide beside a 34px height (mdandlgon a desktop;mdis 32px on a touch screen) and 36px besidelg's 44px on a touch screen, with the size's chevron (16px atmd, 18px atlg). A square would read as a second icon button beside the first (icon-mdis a 34px square on a desktop); a little narrower than tall, it reads as the end of the main button, and the chevron's ink keeps about 8px of fill on each side. - One divider. The frameless split action needs nothing between its parts, since at rest they are an icon and a chevron on the header. Two parts of the same fill and edge read as one undivided button, so the chevron would seem to belong to the label: a split button draws a line between them. The line is the menu part's start border, the button's own 1.5px edge:
sticker-inkon a sticker,line-strongondefault. The main part draws no end border, so the line is never doubled. It is the edge every sticker has (Stickers), so it brings no new color or weight. In dark mode the die-cut edge (sticker-edge) goes around the whole shape, drawn by the group: around each part it would show as a light seam beside the divider. - Hover and press. The part under the pointer lays its variant's medium tier,
sticker-mediumon a sticker andfill-mediumondefault, and press lays the same; its neighbour stays at rest. Joined frameless parts hover as one control tints a frameless part's neighbour because at rest nothing joins the two. Here the fill, the edge and the divider already draw one shape, so a tint on the neighbour would be a second signal on it, and the medium tier on one part still says which one a click acts on. - Menu open. The menu part keeps its medium tier while its menu is open (
data-popup-open); the main part stays at rest. - Focus. Each part is its own button with its own focus ring, drawn above its neighbour: Tab reaches the main part, then the menu part. In a toolbar the toolbar is one Tab stop and the arrow keys reach the main part, then the menu part, as two of its items: use
FitToolbarSplitButton, which renders these same parts as toolbar buttons and gives way as one item (the main part to +, the ▾ kept). - Disabled. Either part can be disabled on its own and takes the shared disabled look;
disabledonButtonSplitdisables both. - Touch. Each part keeps a Button's 44px hit area (Hit targets):
mdparts overhang above and below, and anlgpart is 44px tall on a touch screen. The menu part, narrower than 44px, also reaches past its end: 16px at 28px wide, 8px at 36px. End its row with the split, or keep that much room before the next control, so the next control doesn't cover the target. - Name the group (
aria-labelonButtonSplit, which isrole="group") and each part, and don't give the group its main part's name: the group "New agent", the main part "Create agent", the menu part "More ways to create an agent".
States
Hover, press, focus and disabled follow States: every button hovers and presses with the medium tier (Hover and press): a sticker lays sticker-medium over itself, a paper-colored button fill-medium.
- Disabled, frameless: a frameless icon button (
ghostat an icon size) and anon-framebutton only turn their icon and textforeground-disabled. No fill or border appears. - Disabled, colored: a disabled pink, orange or red button is no longer a sticker: it takes the shared disabled look.
- Loading:
loadingshows the pixel spinner (Spinner) and keeps the button's width and color. Use it for any wait a button started (Choosing a component). The button stays focusable while it waits and ignores presses (Accessibility).
Content
- Start with a verb and name the result: Send for review, not OK or Submit. In a dialog the title names the object, so its main button says the verb alone: Create in Create channel (Writing).
- Use sentence case (Writing), and repeat the button's words in the dialog it opens (Writing).
- Put an icon before the label (
data-icon="inline-start"), and Return or an arrow after it (data-icon="inline-end"). An image icon markeddata-icon(an<img>mark) takes the same size as an svg icon: 16px inmd, 18px inlgandxl(Iconography). - While loading, say what is happening: Creating….
- A Button narrower than its content (given
min-w-0 max-w-fullin a card or a row) truncates its content rather than overflowing its border: give the labeltruncate, and its icons keep their size. - The exception is a row of equal-width buttons that are each a destination, such as the onboarding footer's links on a phone (Onboarding): there a label may wrap onto two lines and the row grows to the tallest button, all buttons keeping one height. A truncated label in such a row hides where the button goes, and the row can't give one button more width. Two lines at most; a label that needs a third is too long for the row and is shortened.
Accessibility
Button wraps Base UI Button and renders a native <button>. For navigation, render a real link instead: render={<a href="…" />}.
- Give every icon-only button an
aria-labelin sentence case (Add reaction). On devices with a pointer, add a Tooltip with the same name and the shortcut. - A busy button keeps its focus. While
loading, the button isaria-disabled, not nativelydisabled: natively disabling the focused button would drop focus to the page, and it would not come back when the wait ends or fails. It stays focusable and in the tab order, and it blocks its own activation: a click, Enter, Space and the form submission it would start do nothing, so the action can't run twice. A button that isdisabledstays nativelydisabled, loading or not. - While
loading, the spinner is named byloadingLabel. SetloadingLabelto what is happening. - Use
focusableWhenDisabledwhen a Tooltip says what would make an unavailable action usable (the one step, or who can do it; not Raft's internal reason, Writing): the button stays focusable and keeps the disabled look. It also keeps receiving touches, so on a touch screen a press and hold opens that tooltip; a nativelydisabledbutton takes none (Tooltip). ButtonSplitis arole="group"; its two parts are Buttons, and the menu part takesaria-haspopupandaria-expandedfrom the menu trigger it renders as (Split buttons).
API
Button
Also takes the attributes of its element.
ButtonSplit
Also takes the attributes of its element.
ButtonSplitMain, ButtonSplitMenu
Also takes the attributes of its element.
Related
Changes
- 0.107.0 · ChangedA footer link in a phone sheet is a full-width outline button ([Dialog › The sheet](https://raft-design.botiverse.build/components/dialog/#the-sheet)): a
TextLinkwritten first inDialogFootermoves to the end of the sheet's body asButton variant="default" size="md", full width (32px tall, 44px hit area), instead of muted footnote text. - 0.88.0 · Added
FitToolbarSplitButton: a split button as one FitToolbar item ([FitToolbar › Anatomy](https://raft-design.botiverse.build/components/fit-toolbar/#anatomy)). The primary action and its ▾ (Create agent and the other ways to add an agent) areButton's split parts,ButtonSplit,ButtonSplitMainandButtonSplitMenu, each rendered as a toolbar button. The pair takes its steps as a whole: fromplusOrderon the main part is + alone, fromlabelOrderon its icon alone (only with anicon), its label kept as its name and tooltip, and the ▾ stays. It never moves into More.groupLabelnames the pair,menuLabelthe ▾, andmenuTriggeris the menu's trigger (<DropdownMenuTrigger />);disableddisables both parts, and other props go on the main part. In the toolbar the arrow keys reach the main part, then the ▾; the toolbar stays one Tab stop. - 0.8.0 · Breaking Changes
Buttonno longer hasvariant="link"orsize="inline". Underlined text is nowTextLink. A link inside a sentence (a banner's "View Billing") becomes<TextLink variant="strong">; a link on its own (Forgot Password, See All) becomes<TextLink>, which is muted.TextLinkhas no height, border or padding, so drop the classes that took them off. - 0.6.1 · Added
Buttonvariant="on-frame": a frameless button on the yellow frame (rail, web top bar, desktop title bar); on the framemdandicon-mdare the DS 36px frame item. - 0.6.0 · Changed
Buttontransitions are colour-only (notransition-all);xs/smrender asmd,icon-xs/icon-smasicon-md.