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.

Composition & Layout

Card

Surface for grouped content and actions — shadcn-aligned slots, `size="sm"`, header grid with `CardAction`, image hero, and RTL. Build a clear hierarchy with reusable structure, consistent spacing and semantic surfaces. Keep layout decisions close to the content they organize. Import it from @/components/kamod-ui/card.

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 Card and subcomponents from @/components/kamod-ui/card.

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.

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

Usage

Compose CardHeader (title, description, optional CardAction), CardContent, and CardFooter. Set size="sm" on Card for tighter padding. For cover images, use class="pt-0" on the card and place the image as the first block; pair with DirectionProvider for RTL layouts.

Import SetupTypeScript
import { Card } from "@kamod-ch/ui";

Choose a complete composition from the examples below; required child components and props vary by pattern.

Component Examples & Variants

Explore Card in Different Contexts, from the starting pattern to the compositions below. Begin with Demo, 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.

Demo

Structure a Small Task within One Surface. Arrange the login fields between CardHeader and CardFooter, with a header action for a related destination. The card defines the reading order and shared surface; the fields and buttons retain their own form behavior.

Keep labels and validation connected to their inputs; the card supplies layout, while your form owns submission, loading and error behavior.

src/components/CardExample.tsx50 lines
import { Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Input, Label } from "@kamod-ch/ui";

export const Example = () => (
  <Card class="w-full max-w-sm">
    <CardHeader>
      <CardTitle>Login to your account</CardTitle>
      <CardDescription>
        Enter your email below to login to your account
      </CardDescription>
      <CardAction>
        <Button variant="link">Sign Up</Button>
      </CardAction>
    </CardHeader>
    <CardContent>
      <form>
        <div class="flex flex-col gap-6">
          <div class="grid gap-2">
            <Label htmlFor="email">Email</Label>
            <Input
              id="email"
              type="email"
              placeholder="m@example.com"
              required
            />
          </div>
          <div class="grid gap-2">
            <div class="flex items-center">
              <Label htmlFor="password">Password</Label>
              <a
                href="#"
                class="ms-auto inline-block text-sm underline-offset-4 hover:underline"
              >
                Forgot your password?
              </a>
            </div>
            <Input id="password" type="password" required />
          </div>
        </div>
      </form>
    </CardContent>
    <CardFooter class="flex-col gap-2">
      <Button type="submit" class="w-full">
        Login
      </Button>
      <Button variant="outline" class="w-full">
        Login with Google
      </Button>
    </CardFooter>
  </Card>
);

Size

Use Compact Cards Where Density Helps. Set size="sm" for a card with reduced spacing and typography. Compare it with the regular treatment using the same content to decide whether the denser surface still leaves room for descriptions and actions.

Compare the result with real content and buttons rather than judging the empty shell; compact presentation should preserve the same information hierarchy.

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

Image

Let Media Support the Message. Place a prominent image above the card's explanation, with a badge action in the header and a full-width action below. Each region has a distinct role, helping the media support the decision rather than obscure it.

Give meaningful images alternative text, keep decorative overlays out of the reading order, and make the primary action's destination clear without relying on the image alone.

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 Card 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.

Props, slots and variants for this component.

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/card3.7 KB min · 1.2 KB gzipSignals: none

Card

CardProps

Card documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildCardProps

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

Default
—
class
string | SignalLike<string | undefined>CardProps

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

Default
—
size
"default" | "sm"CardProps

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

Default
"default"

CardAction

CardActionProps

CardAction documented props
Prop / typeDescription
class
string | SignalLike<string | undefined>CardActionProps

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

Default
—

CardContent

CardContentProps

CardContent documented props
Prop / typeDescription
class
string | SignalLike<string | undefined>CardContentProps

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

Default
—

CardDescription

CardDescriptionProps

CardDescription documented props
Prop / typeDescription
class
string | SignalLike<string | undefined>CardDescriptionProps

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

Default
—

CardFooter

CardFooterProps

CardFooter documented props
Prop / typeDescription
class
string | SignalLike<string | undefined>CardFooterProps

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

Default
—

CardHeader

CardHeaderProps

CardHeader documented props
Prop / typeDescription
class
string | SignalLike<string | undefined>CardHeaderProps

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

Default
—

CardTitle

CardTitleProps

CardTitle documented props
Prop / typeDescription
class
string | SignalLike<string | undefined>CardTitleProps

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

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.

Card Props

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

CardAction Props

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

CardContent Props

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

CardFooter Props

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

CardHeader Props

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

CardTitle Props

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

Accessibility

Card supplies visual composition rather than an automatic document outline. CardTitle currently renders a div, so its large type does not make it a semantic heading. Add the appropriate heading element when the card introduces a section.

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.