Your next page is taking shape...

Opening Your Next Page…

Loading the guide and preparing its examples for you to explore. The page will appear here automatically when it’s ready, so you can keep this view open without refreshing.

Made for Preact. Built to be yours.

Actions & Selection

Button

Primary actions with variants and sizes; icons via data-icon; asChild for links; pairs with ButtonGroup and Spinner. Make the next action easy to recognize. Use visual emphasis deliberately and distinguish an action from a persistent selection or a navigation link. Import it from @/components/kamod-ui/button.

Source · Design reference · API reference · Theming · Styles


Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Installation

Import Button from @/components/kamod-ui/button. Use variant and size; use asChild to style a child element such as an anchor.

Install PackagesTerminal
pnpm add @kamod-ch/ui

Copy an example with @kamod-ch/ui or the matching @kamod-ch/ui/… subpath. The code block switches between those two installs. Connect The Global Theme CSS and Tailwind Source Detection before your first render.

Import SetupTypeScript
import { Button } from "@kamod-ch/ui";
Usage PatternTypeScript
<Button variant="outline">Button</Button>

Usage

Primary actions with variants and sizes; icons via data-icon; asChild for links; pairs with ButtonGroup and Spinner.

Import SetupTypeScript
import { Button, Spinner } from "@kamod-ch/ui";
Usage PatternTypeScript
<Button disabled>
  <Spinner size="sm" data-icon="inline-start" />
  Generating
</Button>

Component Examples & Variants

Explore Button in Different Contexts, from the starting pattern to the compositions below. Begin with Variants, then compare the examples that match your content, state and layout. These are working patterns to adapt, not a list of interchangeable variant values: check the API Reference before using a prop or combining behaviors. Look at the surrounding labels, supporting text and spacing as well as the component itself.

Read the Result and Its Implementation Together. Use each showcase’s Code view to inspect imports and composition, or its Prompt view to prepare a setup or adaptation brief. Try the narrow preview and local theme controls before connecting real data, and use Reset to return an example to its initial state. Keep layout changes in class utilities where appropriate; follow the Component Styles Guide for hierarchy and the Theming Guide for shared surfaces and colors. The Accessibility Notes explain what to preserve when making those changes.

Variants

Set variant for emphasis and size for density. Confirm a destructive action with Alert Dialog, and group related actions with Button Group.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

With Icon

Place an icon with data-icon="inline-start" or data-icon="inline-end", and give an icon-only button an aria-label.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Spinner

Show Spinner beside a loading label and disable the button while the action is pending.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

As Child

Use asChild to style a link without wrapping it in another button.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width
API reference

Props and Data

Configure Button using the contracts below. Read the documented options alongside the Source Definitions to understand which values your application supplies and which details the component owns. Start with a prop or helper, then follow its type link to inspect the declaration without leaving the page.

Button props and accepted values.

API reference
Your API, from source

Type cards are extracted from this checkout’s TypeScript source at build time. Props inherited through HTMLAttributes, Omit or variant helpers remain references in those declarations; their fields are not flattened here. Match the reference to your installed version, and check a package’s exports before writing an import type. A type exported by a source file is not necessarily re-exported by @kamod-ch/ui.

Component Props

Read each option with its owning component. The
marker identifies required fields verified in that declaration. A ? means a field can be omitted; it does not promise a fallback value. Existing documented defaults remain alongside the descriptions. For callbacks, check the argument and return types before connecting your own state or services.
@kamod-ch/ui/button9.6 KB min · 2.9 KB gzipSignals: none

Button

ButtonProps

Button documented props
Prop / typeDescription
asChild
booleanButtonProps

Configure asChild for Button. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false
children
ComponentChild[] | ComponentChildButtonProps

Configure children for Button. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | (string & SignalLike<string | undefined>)ButtonProps

Configure class for Button. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
href
Signalish<string> & stringButtonProps

Configure href for Button. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
size
"xxs" | "xs" | "sm" | "default" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg"ButtonProps

Configure size for Button. Compare its accepted type with the Usage Guidance before supplying a value.

Default
"default"
variant
"default" | "secondary" | "inverse" | "outline" | "ghost" | "destructive" | "link"ButtonProps

Configure variant for Button. Compare its accepted type with the Usage Guidance before supplying a value.

Default
"default"

Data Type Reference

Expand a card to inspect and copy the exact declaration. The code header identifies its repository file; follow imported or inherited types in the Implementation Source when you need the complete dependency chain. Required-field summaries cover fields declared directly in that type. Source-only helpers and inferred schema outputs describe the local implementation, not additional props you can pass to every component.

Common Props

3 declared fields
CommonProps
Local Source Declaration from Button.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of CommonProps before adapting it.

Button Props

Declaration
ButtonProps
Exported Source Declaration from Button.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of ButtonProps before adapting it.

Accessibility

Button renders a native button, an anchor when href is supplied, or the provided child with asChild. Its variant changes appearance, not semantics. On the native button path, an omitted type defaults to button; explicit type="submit" or type="reset" replaces that default. An href button remains an anchor without a type attribute.

Take the Next Useful Step

You have the pieces. Put them into one real interaction, keep its state in one place, and check the result with the content your application will actually show.

Connect the Foundation

Return to Choose and Compose Components to connect this reference to a working screen. Keep global CSS in one entrypoint and import only the components that screen needs.

Build the Surrounding Screen

Find a neighboring interaction in the Component Library, or start with a complete Block. Replace sample content and destinations before refining the layout; a local class change can stay with the composition.

Make the Result Hold Up

Use shared theme roles for changes that belong everywhere. Then review the whole journey: keyboard focus, long labels, narrow screens and a clear way to recover when something fails.

Keep a link to the source and note your intentional changes. Your next edit should begin with a clear decision, not another search.