Skip to content
SENVENLI UI

Button

Starts an action on this page or submits a form.
Actions in a view
import { Button } from "@senvenli/react/action";

Examples

With an icon

An icon before or after the label, or alone with an accessible name.

Sizes

Compact for dense tables and toolbars, large for a page's main call to action.

Disabled and pending

A pending button keeps its width and its name while the work runs.

Radius

`radius`: none, small, medium (the design), large or full; the provider can set it for every component.

Guidelines

When to use it

  • The press changes something on this page: save, send, open a dialog.
  • A call to action that navigates: "Add product" to /products/new.

Use something else when

  • The action sits inside running text. Link

Do and avoid

  • One primary button per view.
  • Use danger only to confirm a destructive step.
  • Label with a verb in sentence case: "Save changes".

Accessibility

Keyboard

KeysWhat happens
Enter, SpacePresses the button.
EnterFollows the link.

Built in

  • Pending and disabled states are exposed to assistive technology.
  • A 44px hit area under coarse pointers without changing the layout.
  • Keeps link semantics: role link and a real href that works without JavaScript.

You provide

  • An aria-label when the button shows only an icon.
  • An aria-label when it shows only an icon.

API reference

Button

variant
ButtonVariant

primary is the one main action of a view; subtle for toolbars and rows; link for a quiet text action.

tone
ButtonTone

danger for a destructive action (delete, discard); it keeps the variant's shape.

fullWidth
boolean

As wide as its container (a form's submit on a phone, a stacked set of actions).

radius
ComponentRadius

Corner radius: none, small, medium (the design), large or full (a pill). The provider's default otherwise.

size
ButtonSize
iconBefore
IconName

Lucide icon name shown before the label ("plus").

iconAfter
IconName

Lucide icon name shown after the label.

children
React.ReactNode
iconOnly
false | true
href
string

Where it goes. Rendered as a real href, so the link works before (and without) JavaScript.

isExternal
boolean

Link's convention: opens in a new tab with noopener noreferrer, shows arrow-up-right after the label (unless iconAfter is set) and tells screen readers it opens a new tab. With onPress a plain click opens nothing (the app handles it in place), so the arrow and the new-tab words are left out; target and rel stay for the page before JavaScript. Disabled, it opens nothing either: no target, rel or new-tab words (the arrow stays, as iconAfter would).

Also takes 84 standard DOM and ARIA attributes (id, aria-label, event handlers…).