Skip to content
bref / ui

Svelte components, simply.

Star

Button

An action or navigation control with text or icon labels, theme colors, five sizes, three variants, and wide, rounded or disabled options.

Usage

Next
Svelte
<script>
	import { Button } from 'bref-ui';
</script>

<Button label="Save" onClick={() => undefined} />
<Button
	label="Next"
	href="/next"
	color="primary"
	variant="filled"
	trailingIcon={{ name: 'arrow_forward' }}
/>
<Button
	icon={{ name: 'favorite', filled: true }}
	rounded
	onClick={() => undefined}
	aria-label="Favorite"
/>
<Button label="Unavailable" disabled />

Playground

Combine appearance, content and behavior. Glass and the preview background are independent.

Live preview

Activated 0 times. Try Tab, Enter and Space.

Settings

Appearance
Content
Behavior
View generated code
Svelte
<script>
	import { Button } from 'bref-ui';
	let clicks = $state(0);
	const activate = () => clicks++;
</script>

<Button
	label={'Save'}
	glass={false}
	size="medium"
	variant="neutral"
	color="foreground"
	wide={false}
	icon={{ name: 'save', filled: false }}
	trailingIcon={{ name: 'arrow_forward', filled: false }}
	disabled={false}
	onClick={activate}
/>
<Button
	glass={false}
	size="medium"
	variant="neutral"
	color="foreground"
	rounded={false}
	icon={{ name: 'save', label: 'Save', filled: false }}
	disabled={false}
	onClick={activate}
/>

Sizes, colors and variants

At the default root font size, the five sizes start at 28, 32, 40, 48 and 56 pixels tall. Coarse pointers receive at least a 44-pixel target. Text can wrap and controls grow with larger text.

Sizes

Variants

Colors

Text and icon shapes

Disabled neutral

Disabled soft

Disabled filled

The exhaustive QA matrix is mounted only when requested.

Props

Component props
PropTypeRequiredDefaultDescription
hrefstringFor linksOmittedRender an anchor for navigation; omit for a native button.
labelstringFor text buttonsOmittedVisible text; omit for icon-only buttons.
iconOmit<IconProps, 'size' | 'color'>For icon-only buttonsOmittedLeading icon; required when label is omitted.
sizeSizeNomediumx-small, small, medium, large or x-large.
variantVariantNoneutralneutral, soft or filled.
colorExclude<Color, 'background'>NoforegroundTheme color excluding background.
trailingIconOmit<IconProps, 'size' | 'color'>NoOmittedIcon after the label; text buttons only.
widebooleanNofalseFull width; text buttons only.
roundedbooleanNofalseCircular shape; icon-only buttons only.
glassbooleanNofalseAdds translucent paint and backdrop blur to the selected variant.
disabledbooleanNofalseDisables actions and navigation; uses muted paint for the selected variant.
onClickMouseEvent handlerNoOmittedClick handler for actions and links; replaces native onclick.

Native behavior

Use onClick for actions or href for navigation. Pass native button or anchor attributes directly, including form attributes, ARIA attributes and events except onclick , which uses onClick , class and style .

Button uses type="button" unless overridden. Set type to submit or reset for native form actions. Button does not accept a children snippet or expose an element binding.

Use native target and rel for links. Event handlers are optional; button handlers receive an HTMLButtonElement currentTarget and link handlers an HTMLAnchorElement.

Full-width link in a new tab Disabled link

No submission yet.

Svelte
<Button
	label="Saving…"
	icon={{ name: 'sync' }}
	variant="filled"
	onClick={save}
	disabled
	aria-busy={true}
/>
<Button label="Submit" onClick={save} type="submit" name="action" value="save" />
<Button label="Reset" onClick={reset} type="reset" />
<Button
	label="Full-width link in a new tab"
	href="#native-behavior"
	wide
	target="_blank"
	rel="noopener noreferrer"
	color="primary"
	variant="soft"
	trailingIcon={{ name: 'open_in_new' }}
/>

Accessibility

Use a visible label for text buttons and aria-label for icon-only buttons. Icon-only names fall back to the icon label, then its name. Rendered icons are decorative.

Enter and Space activate focused buttons; disabled buttons skip keyboard navigation. Compose pending states with disabled and aria-busy ; there is no loading prop. Verify contrast when changing colors or surfaces.