Button Svelte Component

Contents

Button Components

There are following components included:

  • Button - single button

Button Props

NameTypeDefaultDescription
clearbooleanundefined

Makes button in clear style (without fill color). Overwrites

clearIosbooleanfalse

Makes button in clear style (without fill color) in iOS theme

clearMaterialbooleanfalse

Makes button in clear style (without fill color) in Material theme

colorsobject

Object with Tailwind CSS colors classes

colors.clearBgIosstring'bg-transparent active:bg-primary/15'
colors.clearBgMaterialstring'bg-transparent'
colors.disabledBgstring'bg-black/10 dark:bg-white/10'
colors.disabledBorderstring'border-black/10 dark:border-white/10'
colors.disabledTextstring'text-black/30 dark:text-white/30'
colors.fillBgIosstring'bg-primary active:bg-ios-primary-shade'
colors.fillBgMaterialstring'bg-md-light-primary dark:bg-md-dark-primary'
colors.fillTextIosstring'text-white'
colors.fillTextMaterialstring'text-md-light-on-primary dark:text-md-dark-on-primary'
colors.fillTouchRipplestring'touch-ripple-white dark:touch-ripple-primary'
colors.outlineBgIosstring'bg-transparent active:bg-primary/15'
colors.outlineBgMaterialstring'bg-transparent'
colors.outlineBorderIosstring'border-primary'
colors.outlineBorderMaterialstring'border-md-light-outline dark:border-md-dark-outline'
colors.segmentedStrongTextIosstring'text-black'
colors.segmentedStrongTextMaterialstring''
colors.textIosstring'text-primary'
colors.textMaterialstring'text-md-light-primary dark:text-md-dark-primary'
colors.tonalBgIosstring'bg-primary/15 active:bg-primary/25'
colors.tonalBgMaterialstring'bg-md-light-secondary-container dark:bg-md-dark-secondary-container'
colors.tonalTextIosstring'text-primary'
colors.tonalTextMaterialstring'text-md-light-on-secondary-container dark:text-md-dark-on-secondary-container'
colors.touchRipplestring'touch-ripple-primary'
componentstring'button'

Component's HTML Element

disabledbooleanfalse

Makes button disabled

inlinebooleanfalse

Makes button inline (e.g.

largebooleanundefined

Makes button large. Overwrites

largeIosbooleanfalse

Makes button large in iOS theme

largeMaterialbooleanfalse

Makes button large in Material theme

outlinebooleanundefined

Makes button outline. Overwrites

outlineIosbooleanfalse

Makes button outline in iOS theme

outlineMaterialbooleanfalse

Makes button outline in Material theme

raisedbooleanundefined

Makes button raised (with shadow). Overwrites

raisedIosbooleanfalse

Makes button raised (with shadow) in iOS theme

raisedMaterialbooleanfalse

Makes button raised (with shadow) in Material theme

roundedbooleanundefined

Makes button rounded. Overwrites

roundedIosbooleanfalse

Makes button rounded in iOS theme

roundedMaterialbooleanfalse

Makes button rounded in Material theme

segmentedbooleanfalse

Renders segmented button, same as

segmentedActivebooleanfalse

Renders segmented active button, same as

segmentedStrongbooleanfalse

Renders segmented strong button, same as

smallbooleanundefined

Makes button small. Overwrites

smallIosbooleanfalse

Makes button small in iOS theme

smallMaterialbooleanfalse

Makes button small in Material theme

tonalbooleanundefined

Makes button in tonal style (with semitransparent fill color). Overwrites

tonalIosbooleanfalse

Makes button in tonal style (with semitransparent fill color) in iOS theme

tonalMaterialbooleanfalse

Makes button in tonal style (with semitransparent fill color) in Material theme

onClickfunction(e)

Examples

Buttons.svelte
<script>
import {
Page,
Navbar,
NavbarBackLink,
Button,
Block,
BlockTitle,
} from 'konsta/svelte';
</script>
<Page>
<Navbar title="Buttons">
{#snippet left()}
{#if !isPreview}
<NavbarBackLink onclick={() => history.back()} />
{/if}
{/snippet}
</Navbar>
<BlockTitle>Default Buttons</BlockTitle>
<Block strong inset class="space-y-2">
<div class="grid grid-cols-3 gap-x-4">
<Button>Button</Button>
<Button class="k-color-brand-red">Button</Button>
<Button>Button</Button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<Button outline>Outline</Button>
<Button class="k-color-brand-red" outline>Outline</Button>
<Button outline>Outline</Button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<Button clear>Clear</Button>
<Button class="k-color-brand-red" clear>Clear</Button>
<Button clear>Clear</Button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<Button tonal>Tonal</Button>
<Button class="k-color-brand-red" tonal>Tonal</Button>
<Button tonal>Tonal</Button>
</div>
</Block>
<BlockTitle>Rounded Buttons</BlockTitle>
<Block strong inset class="space-y-2">
<div class="grid grid-cols-3 gap-x-4">
<Button rounded>Button</Button>
<Button rounded class="k-color-brand-green">Button</Button>
<Button rounded>Button</Button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<Button rounded outline>Outline</Button>
<Button rounded outline class="k-color-brand-green">Outline</Button>
<Button rounded outline>Outline</Button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<Button rounded clear>Clear</Button>
<Button rounded clear class="k-color-brand-green">Clear</Button>
<Button rounded clear>Clear</Button>
</div>
</Block>
<BlockTitle>Large Buttons</BlockTitle>
<Block strong inset class="space-y-2">
<div class="grid grid-cols-3 gap-x-4">
<Button large>Button</Button>
<Button large class="k-color-brand-yellow">Button</Button>
<Button large rounded>Button</Button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<Button large outline>Outline</Button>
<Button large outline class="k-color-brand-yellow">Outline</Button>
<Button large rounded outline>Outline</Button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<Button large clear>Clear</Button>
<Button large clear class="k-color-brand-yellow">Clear</Button>
<Button large rounded clear>Clear</Button>
</div>
</Block>
<BlockTitle>Small Buttons</BlockTitle>
<Block strong inset class="space-y-2">
<div class="grid grid-cols-3 gap-x-4">
<Button small>Button</Button>
<Button small>Button</Button>
<Button small rounded>Button</Button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<Button small outline>Outline</Button>
<Button small outline>Outline</Button>
<Button small rounded outline>Outline</Button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<Button small clear>Clear</Button>
<Button small clear>Clear</Button>
<Button small rounded clear>Clear</Button>
</div>
</Block>
<BlockTitle>Raised Buttons</BlockTitle>
<Block strong inset class="space-y-2">
<div class="grid grid-cols-3 gap-x-4">
<Button raised>Button</Button>
<Button raised>Button</Button>
<Button raised rounded>Button</Button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<Button raised outline>Outline</Button>
<Button raised outline>Outline</Button>
<Button raised rounded outline>Outline</Button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<Button raised clear>Clear</Button>
<Button raised clear>Clear</Button>
<Button raised rounded clear>Clear</Button>
</div>
</Block>
<BlockTitle>Disabled Buttons</BlockTitle>
<Block strong inset class="space-y-2">
<div class="grid grid-cols-3 gap-x-4">
<Button disabled>Button</Button>
<Button disabled outline>Outline</Button>
<Button disabled clear>Clear</Button>
</div>
</Block>
</Page>
Code licensed under MIT.
2025 © Konsta UI by nolimits4web.