enes

Button

A button triggers an action or event when activated and supports three visual appearances: accent, standard, and subtle.

Usage

<script>
	import { Button } from 'fluentui-svelte';
</script>

<Button>I am a Button</Button>

Component API

A brief explanation of the props that really need explaining. You can see the rest of the props here.

As

You can control which tag the button component should use: button, a, or div.

I am a Anchor
I am a Div

Shape

A button can be rounded, circular, or square. Default: rounded.

Appearance

A button can have its content and borders styled for greater emphasis or to be subtle.

Component Props

NameTypeDescription
refHTMLElementThe DOM reference of the button element.
asstringThe DOM element to render. Possible values: 'button', 'a', 'div'.
disabledbooleanDisables user interaction.
shapestringThe shape of the button or buttons. Possible values: 'circular', 'rounded', 'square'.
appearancestringThe appearance of the button or buttons. Possible values: 'accent', 'standard', 'subtle'.
disabledFocusablebooleanAllows the button to be focusable even when disabled.
isMenuButtonbooleanAdds an icon that indicates the button triggers a menu.
indicatorPosition'before' | 'after'The position of the icon. Possible values: 'before', 'after'.
indicatorIconSnippet | ComponentThe icon used as the menu indicator. Defaults to a chevron-down icon.
Element AttributesBased on the chosen component tag, you will get autocomplete for all HTML attributes of that tag.

Split Button

A split button is a special type of button that combines a standard button with a menu button to provide users with a primary action and additional options.

Usage

<script>
	import { SplitButton } from 'fluentui-svelte';
</script>

<SplitButton />
<SplitButton appearance="standard" />
<SplitButton appearance="subtle" />
<SplitButton shape="circular" />
<SplitButton shape="circular" appearance="standard" />
<SplitButton shape="circular" appearance="subtle" />

Adding a Menu

To add a menu to the split button, please refer to the Menu documentation for details on how to create menus and pass them as a prop to the SplitButton component.

Component Props

NameTypeDescription
wrapperRefHTMLDivElementThe DOM reference of the split button wrapper element.
primaryButtonRefHTMLButtonElementThe DOM reference of the primary button element.
primaryButtonPropsButtonProps<'button'>Additional props to pass to the primary button.
menuTriggerRefHTMLButtonElementThe DOM reference of the menu trigger button element.
menuTriggerPropsButtonProps<'button'>Additional props to pass to the menu trigger button.
classstringAdditional classes to add to the split button wrapper element.
shapestringThe shape of the button or buttons. Possible values: 'circular', 'rounded', 'square'.
appearancestringThe appearance of the button or buttons. Possible values: 'accent', 'standard', 'subtle'.
disabledbooleanDisables user interaction.
WrapperElement AttributesHTMLElement AttributesAll other attributes can be applied to the split button wrapper element.