Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/danielitoCode/compose_svelted/llms.txt

Use this file to discover all available pages before exploring further.

Compose Svelted’s button family follows the Material 3 button taxonomy. Three variants — Button, TonalButton, and CheckButton — are fully implemented with documented props and interactive behavior. Six additional variants (TextButton, IconButton, ButtonWithIcon, OutlinedButton, OutlinedButtonWithIcon, OutlinedIconButton) exist as placeholder stub files with no implementation yet. All fully-implemented variants share the same composable philosophy: slots accept any child content, Modifier handles layout, and ColorToken props keep colors tied to the active theme.

Implemented button variants

Button is the primary filled button. It renders an elevated, solid-background button ideal for the single most important action on a screen.

Props

onClick
() => void
default:"() => {}"
Callback invoked when the user taps or clicks the button.
modifier
Modifier
default:"Modifier.empty()"
Controls layout, size, padding, and other inline styles.
color
ColorToken | string
default:"'primary'"
Background fill color. Accepts a ColorToken or a raw CSS color string.
onColor
ColorToken | string
default:"'onPrimary'"
Foreground (text/icon) color, intended to contrast with color.
shape
'none' | 'extraSmall' | 'small' | 'medium' | 'large'
default:"'large'"
Corner radius shape. Resolved against --md-sys-shape-{shape}.
elevation
'level0' | 'level1' | 'level2' | 'level3' | 'level4'
default:"'level1'"
Box-shadow elevation tier. Resolved against --md-sys-elevation-{elevation}.

Slot

SlotDescription
defaultButton label, icon, or any inline content.

Examples

<script>
  import { Button, ColorScheme, Modifier } from '@danielito1996/compose-svelted';
</script>

<!-- Default primary button -->
<Button onClick={() => alert('Confirmed')}>
  Confirm
</Button>

<!-- Secondary color, full width -->
<Button
  onClick={() => alert('Secondary action')}
  color={ColorScheme.Secondary}
  onColor={ColorScheme.OnSecondary}
  modifier={Modifier.fillMaxWidth()}
>
  Secondary action
</Button>

<!-- Custom shape and elevation -->
<Button
  onClick={() => {}}
  shape="medium"
  elevation="level3"
>
  Elevated medium
</Button>

Placeholder stub variants

The following six button components exist as empty files in the source repository. They have no implementation yet and therefore have no documented props. Do not rely on them in production — they are reserved for future releases.
ComponentFileStatus
TextButtonbuttons/TextButton.sveltePlaceholder stub — 0 bytes
IconButtonbuttons/IconButton.sveltePlaceholder stub — 0 bytes
ButtonWithIconbuttons/ButtonWithIcon.sveltePlaceholder stub — 0 bytes
OutlinedButtonbuttons/OutlinedButton.sveltePlaceholder stub — 0 bytes
OutlinedButtonWithIconbuttons/OutlinedButtonWithIcon.sveltePlaceholder stub — 0 bytes
OutlinedIconButtonbuttons/OutlinedIconButton.sveltePlaceholder stub — 0 bytes
These stub components contain no Svelte script, markup, or styles. Importing them will produce an empty element with no behavior. Props listed in any earlier version of this documentation for these variants were inaccurate and have been removed.

Combining implemented variants

A typical action bar uses multiple button types in a single Row to express a clear hierarchy: a primary Button for the main action, a TonalButton for a secondary action, and a CheckButton to gate submission behind an agreement toggle.
<script>
  import {
    Row, Column, Button, TonalButton,
    CheckButton, Arrangement, Alignment, Modifier
  } from '@danielito1996/compose-svelted';

  let agreed = false;
</script>

<Column
  modifier={Modifier.padding(24)}
  verticalArrangement={Arrangement.spacedBy(16)}
>
  <!-- Agreement toggle -->
  <CheckButton
    checked={agreed}
    onCheckedChange={(v) => agreed = v}
  >
    I agree to the privacy policy
  </CheckButton>

  <!-- Action row -->
  <Row
    horizontalArrangement={Arrangement.spacedBy(8)}
    verticalAlignment={Alignment.CenterVertically}
  >
    <Button onClick={() => console.log('submit')} modifier={Modifier.weight(1)}>
      Submit
    </Button>

    <TonalButton onClick={() => console.log('save draft')}>
      Save draft
    </TonalButton>
  </Row>
</Column>
Button and TonalButton accept any Svelte content in their default slot. You can freely nest Icon, Text, Row, or even another Surface inside a button to build fully custom appearances while keeping the interaction semantics.

Build docs developers (and LLMs) love