Skip to content
Porcelana

Button

Raised, outline, ghost and danger buttons with icons, a loading state and asChild for links.

Actions

Example

Link styled as a button
Example.tsx
import { Button } from "@porcelana/ui";
import { AlarmIcon, TrashIcon } from "@porcelana/icons";

export default function Example() {
  return (
    <div style={{ display: "flex", flexWrap: "wrap", gap: 12 }}>
      <Button>Save</Button>
      <Button variant="soft" startIcon={<AlarmIcon size={18} />}>
        Snooze
      </Button>
      <Button variant="outline">Outline</Button>
      <Button variant="ghost">Ghost</Button>
      <Button variant="danger" startIcon={<TrashIcon size={18} />}>
        Delete
      </Button>
      <Button loading>Saving</Button>
      <Button asChild variant="outline">
        <a href="#props">Link styled as a button</a>
      </Button>
    </div>
  );
}

Import

Import
import { Button } from "@porcelana/ui";
import "@porcelana/ui/styles.css"; // once, at your app root

Props

Generated from the TypeScript types. Standard HTML attributes are passed through and not listed.

Button

PropTypeDefaultDescription
aria-labelstring–Defines a string value that labels the current element. @see aria-labelledby.
asChildbooleanfalseRender the child element (e.g. a link) with button styling.
blockboolean | null–Stretch to the full width.
disabledboolean–Prevents interaction and dims the control.
endIconReactNode–Icon after the label.
idstring–Element id. Generated automatically when omitted.
loadingbooleanfalseShows a spinner, sets aria-busy and blocks clicks while keeping focus.
size"sm" | "md" | "lg" | null–Size. Every size keeps at least a 44px touch target.
startIconReactNode–Icon before the label.
type"button" | "submit" | "reset"–Button type (defaults to "button").
variant"primary" | "soft" | "outline" | "ghost" | "danger" | null–Visual style.

Accessibility

  • Renders a real <button type="button"> unless you pass type or asChild.
  • loading sets aria-busy and aria-disabled but keeps the button focusable, so screen-reader users don't lose their place.
  • Use asChild with an <a> for navigation, so the element keeps link semantics.

Mobile

  • Minimum height is 44px at every size, including sm.
  • Presses scale down slightly for touch feedback, without a 300ms tap delay.