Skip to content
LyEve UI v0.60.1

Form controls

Button

The control a reader presses to do something. It comes in six variants and three sizes, plus a square for an icon alone, shows a spinner while its action runs, and takes an href when it should be a link that looks like a button.

Variants

Sizes

Icon only

size="icon" draws a square that the icon sets, for a control with no words beside it, such as a menu or a settings button next to the theme toggle. Name it with aria-label: the name is read to a screen reader and shown as a hint on hover. Under a touch screen it grows to the control height, like every button.

With icons

Buttons render their children verbatim, so any @lucide/svelte icon drops in alongside text. Spacing is handled by the button itself.

Loading & disabled

As a link

Pass href to render an <a> with the same styling, for navigation that should behave like a real link.

API

PropTypeDefaultDescription
variant 'primary' | 'secondary' | 'danger' | 'ghost' | 'outline' | 'violet''primary'Visual style.
size 'sm' | 'md' | 'lg' | 'icon''md'Padding and font size. 'icon' draws a square for an icon alone.
type 'button' | 'submit' | 'reset''button'Native button type.
href string no defaultRender as an <a> instead of a <button>.
loading booleanfalseShow a spinner and prevent clicks.
disabled booleanfalseDisable the button.
full booleanfalseStretch to fill the container width.
onclick (e: MouseEvent) => void no defaultClick handler.
hint string | false no defaultWords shown on hover and focus. They default to the aria-label, so an icon-only button names itself on screen too. Pass false to show none.
children requiredSnippet no defaultButton content (text and/or icons).
class string no defaultExtra classes, appended to the component's own.