Svelte Buttons - Bitblue

Use the button component inside forms, as links, social login, payment options with support for multiple styles, colors, sizes, gradients, and shadows

The button component is probably the most widely used element in any user interface or website as it can be used to launch an action but also to link to other pages.

Setup

pnpm add @cailabs/components.base
<script>
	import { Button } from '@cailabs/components.base';
</script>

See Installation for umbrella and segment packages.

Default button

Use these default button styles with multiple colors to indicate an action or link within your website.

<script>
	import { Button } from '.';
</script>

<Button>Default</Button>
<Button color="alternative">Alternative</Button>
<Button color="dark">Dark</Button>
<Button color="light">Light</Button>
<Button color="blue">Blue</Button>
<Button color="green">Green</Button>
<Button color="red">Red</Button>
<Button color="yellow">Yellow</Button>
<Button color="secondary">Purple</Button>

Button with link

You can add a link to a Button component:

Home
<script>
	import { Button } from '.';
</script>

<Button href="/">Home</Button>

Button pills

The button pills can be used as an alternative style by using fully rounded edges.

<script>
	import { Button } from '.';
</script>

<Button pill>Default</Button>
<Button color="alternative" pill>Alternative</Button>
<Button color="dark" pill>Dark</Button>
<Button color="light" pill>Light</Button>
<Button color="blue" pill>Blue</Button>
<Button color="green" pill>Green</Button>
<Button color="red" pill>Red</Button>
<Button color="yellow" pill>Yellow</Button>
<Button color="purple" pill>Purple</Button>

Gradient monochrome

These beautifully colored buttons built with the gradient color stops utility classes from Tailwind CSS can be used as a creative alternative to the default button styles.

<script>
	import { GradientButton } from '.';
</script>

<GradientButton color="blue">Blue</GradientButton>
<GradientButton color="green">Green</GradientButton>
<GradientButton color="cyan">Cyan</GradientButton>
<GradientButton color="teal">Teal</GradientButton>
<GradientButton color="lime">Lime</GradientButton>
<GradientButton color="red">Red</GradientButton>
<GradientButton color="pink">Pink</GradientButton>
<GradientButton color="purple">Purple</GradientButton>

Gradient duotone

These buttons use a style that includes two contrasted colors creating an impressive mesh gradient effect.

<script>
	import { GradientButton } from '.';
</script>

<GradientButton color="purpleToBlue">Purple to Blue</GradientButton>
<GradientButton color="cyanToBlue">Cyan to Blue</GradientButton>
<GradientButton color="greenToBlue">Green to Blue</GradientButton>
<GradientButton color="purpleToPink">Purple to Pink</GradientButton>
<GradientButton color="pinkToOrange">Pink to Orange</GradientButton>
<GradientButton color="tealToLime">Teal to Lime</GradientButton>
<GradientButton color="redToYellow">Red to Yellow</GradientButton>

Gradient outline

This is a special button style that incorporates a gradient color for the outline that can be used as a secondary style to the fully colored gradient buttons.

<script>
	import { GradientButton } from '.';
</script>

<GradientButton outline color="purpleToBlue">Purple to Blue</GradientButton>
<GradientButton outline color="cyanToBlue">Cyan to Blue</GradientButton>
<GradientButton outline color="greenToBlue">Green to Blue</GradientButton>
<GradientButton outline color="purpleToPink">Purple to Pink</GradientButton>
<GradientButton outline color="pinkToOrange">Pink to Orange</GradientButton>
<GradientButton outline color="tealToLime">Teal to Lime</GradientButton>
<GradientButton outline pill color="redToYellow">Red to Yellow</GradientButton>
<GradientButton outline color="redToYellow" class="w-72">Red to Yellow</GradientButton>

Colored shadows

These beautiful button elements with color shadows can be used since the release of Tailwind v3.0.

<script>
	import { Button, GradientButton } from '.';
</script>

<GradientButton shadow color="blue">Blue</GradientButton>
<GradientButton shadow color="green">Green</GradientButton>
<GradientButton shadow color="cyan">Cyan</GradientButton>
<GradientButton shadow color="teal">Teal</GradientButton>
<GradientButton shadow color="lime">Lime</GradientButton>
<GradientButton shadow color="red">Red</GradientButton>
<GradientButton shadow color="pink">Pink</GradientButton>
<GradientButton shadow color="purple">Purple</GradientButton>

Outline buttons

Use the following button styles to show the colors only for the border of the element.

<script>
	import { Button } from '.';
</script>

<div class="flex justify-center gap-2 flex-wrap">
	<Button outline>Default</Button>
	<Button outline color="dark">Dark</Button>
	<Button outline color="green">Green</Button>
	<Button outline color="red">Red</Button>
	<Button outline color="yellow">Yellow</Button>
	<Button outline color="purple">Purple</Button>
</div>

Button sizes with icons

Use these examples if you want to use smaller or larger buttons.

<script>
	import { Button } from '.';
</script>

<Button size="xs">
	{#snippet leadingIcon()}
		<iconify-icon icon="bi:file-check-fill"> </iconify-icon>
	{/snippet}
	Extra small</Button
>
<Button size="sm">
	{#snippet leadingIcon()}
		<iconify-icon icon="bi:file-check-fill"> </iconify-icon>
	{/snippet}
	small</Button
>
<Button size="md">
	{#snippet leadingIcon()}
		<iconify-icon icon="bi:file-check-fill"> </iconify-icon>
	{/snippet}
	Base</Button
>
<Button size="lg">
	{#snippet leadingIcon()}
		<iconify-icon icon="bi:file-check-fill"> </iconify-icon>
	{/snippet}
	Large</Button
>
<Button size="xl">
	{#snippet leadingIcon()}
		<iconify-icon icon="bi:file-check-fill"> </iconify-icon>
	{/snippet}
	Extra Large</Button
>

Loader

Use the spinner components to indicate a loader animation inside buttons.

<script>
	import { Button, Spinner } from '.';
</script>

<Button loading>
	Loading ...
</Button>

Disabled

You can add any additional button attributes. The following example shows adding the disabled attribute.

<script>
	import { Button } from '.';
</script>

<Button disabled>Disabled</Button>

Shadow

Colored elevation shadows for solid buttons.

<script>
	import { Button } from '.';
</script>

<Button shadow>Primary</Button>
<Button shadow color="blue">Blue</Button>
<Button shadow color="green">Green</Button>
<Button shadow color="red">Red</Button>

Ripple

Enable a click ripple effect with ripple. Prefer this only in interactive examples (client-side).

<script>
	import { Button } from '.';
</script>

<Button ripple color="blue">Ripple</Button>
<Button ripple outline color="purple">Outline ripple</Button>

Icons (leading / trailing)

Use leadingIcon and trailingIcon snippets for icon placement.

<script>
	import { Button } from '.';
</script>

<Button>
	{#snippet leadingIcon()}
		<iconify-icon icon="bi:download"></iconify-icon>
	{/snippet}
	Download
</Button>
<Button color="green">
	Next
	{#snippet trailingIcon()}
		<iconify-icon icon="bi:arrow-right"></iconify-icon>
	{/snippet}
</Button>

Composition notes

  • With href, the component renders an <a>; otherwise a <button type="button"> (or custom tag).
  • Inside ButtonGroup, size defaults to sm and color defaults based on outline state.
  • loading forces disabled and appends a Spinner (spinnerProps customizes it).
  • Native button/anchor attributes (type, target, rel, onclick, …) are forwarded.

Props

ButtonProps

PropTypeDefaultDescription
colorprimary | dark | alternative | light | secondary | gray | red | orange | amber | yellow | lime | green | emerald | teal | cyan | sky | blue | indigo | violet | purple | fuchsia | pink | roseprimaryTheme color
sizexs | sm | md | lg | xlmdPadding / font size
pillbooleanfalseFully rounded
outlinebooleanfalseBorder-only style
shadowbooleanfalseColored drop shadow
disabledboolean—Disable interaction
loadingbooleanfalseShows spinner; disables button
spinnerPropsPartial<SpinnerProps>{ size: '4', color: 'white' }Spinner overrides when loading
ripplebooleanfalseClick ripple effect
hrefstring—Render as link
tagstringbuttonCustom element tag when not a link
leadingIconSnippet—Content before children
trailingIconSnippet—Content after children
childrenSnippet—Button label / content
classClassValue—Extra classes
…restbutton / anchor attrs—Forwarded to the root element

GradientButtonProps

PropTypeDefaultDescription
colorblue | green | cyan | teal | lime | red | pink | purple | purpleToBlue | cyanToBlue | greenToBlue | purpleToPink | pinkToOrange | tealToLime | redToYellowblueGradient preset
sizexs | sm | md | lg | xl—Padding / font size
pillbooleanfalseFully rounded
outlineboolean—Gradient border shell
shadowboolean—Drop shadow
disabledboolean—Disable interaction
hrefstring—Render as link
tagstring—Custom tag
btnClassClassValue—Classes on inner button (outline mode)
leadingIconSnippet—Content before children
trailingIconSnippet—Content after children
childrenSnippet—Label / content
classClassValue—Wrapper / root classes
…restbutton / anchor attrs—Forwarded to the inner control

Snippets

SnippetComponentsDescription
leadingIconButton, GradientButtonIcon / node before the label
trailingIconButton, GradientButtonIcon / node after the label
childrenButton, GradientButtonMain label content

© 2026 Bitblue is a registered trademark. All Rights Reserved.