Components / Actions
Button
A link styled as a button, in five variants and three sizes: md for marketing pages, sm for the console, xs for dense console panels. danger is for destructive actions, such as a stop switch. External links open in a new tab and get an up-right arrow.
Extracted fromMarketing siteExplorer
Import
tsx
import { Button, buttonClass } from "@somnia-chain/ui"
// in a Next.js app, internal links use next/link:
import { Button, buttonClass } from "@somnia-chain/ui/next"Examples
Variants
examples/button/variants.tsxShow codeHide code
tsx
import { Button } from "@somnia-chain/ui"
export default function ButtonVariants() {
return (
<div className="flex flex-wrap items-center gap-3">
<Button href="#">Talk to an expert</Button>
<Button href="#" variant="secondary">
Read the docs
</Button>
<Button href="#" variant="ghost">
Ghost
</Button>
<Button href="https://docs.somnia.network" variant="secondary">
External link
</Button>
<Button href="#" variant="danger">
Revoke session
</Button>
</div>
)
}Sizes
Use buttonClass() to style a real <button> the same way.
examples/button/sizes.tsxShow codeHide code
tsx
import { Button, buttonClass } from "@somnia-chain/ui"
export default function ButtonSizes() {
return (
<div className="flex flex-wrap items-center gap-3">
<Button href="#" size="md">
Marketing (md)
</Button>
<Button href="#" size="sm">
Console (sm)
</Button>
<Button href="#" size="sm" variant="secondary">
Secondary
</Button>
<button type="button" className={buttonClass({ size: "sm", variant: "secondary" })}>
A real <button>
</button>
<Button href="#" size="xs" variant="secondary">
Dense panel (xs)
</Button>
<button type="button" className={buttonClass({ size: "xs", variant: "danger" })}>
Stop
</button>
</div>
)
}On violet
inverse is for the violet band.
examples/button/inverse.tsxShow codeHide code
tsx
import { Button } from "@somnia-chain/ui"
export default function ButtonInverse() {
return (
<div className="tone-violet flex flex-wrap gap-3 rounded-[6px] p-8">
<Button href="#" variant="inverse">
Talk to an expert
</Button>
<Button href="#" variant="secondary" className="text-white">
Start building
</Button>
</div>
)
}Props
Button