Skip to content
View as Markdown

Button ​

The Button component is a styled button with multiple visual variants and sizes. It supports rendering as a custom element via the render prop (Base UI render pattern).

Import ​

tsx
import { Button } from "@tailor-platform/app-shell";

The examples below also import Link and buttonVariants from @tailor-platform/app-shell and PlusIcon from lucide-react.

Basic Usage ​

tsx
function BasicUsage() {
  return (
    <div className="flex gap-2">
      <Button>Click me</Button>
      <Button variant="outline">Outline</Button>
      <Button variant="destructive">Delete</Button>
    </div>
  );
}

Props ​

Generated from the type surface — first-party props only.

ButtonProps ​

PropTypeDefaultDescription
render?React.ReactElement-Custom element to render as (Base UI render prop)
size?"default" | "sm" | "lg" | "xs" | "icon" | null"default"Button size
variant?"link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null"default"Visual style variant

Exports ​

  • Button — function
  • ButtonProps — type
  • buttonVariants — const

All standard HTML <button> props are also accepted.

Variants ​

tsx
function Variants() {
  return (
    <div className="flex flex-wrap gap-2">
      <Button variant="default">Primary Action</Button>
      <Button variant="destructive">Delete</Button>
      <Button variant="outline">Secondary Action</Button>
      <Button variant="secondary">Tertiary</Button>
      <Button variant="ghost">Ghost</Button>
      <Button variant="link">Link Style</Button>
    </div>
  );
}

Sizes ​

tsx
function Sizes() {
  return (
    <div className="flex items-center gap-2">
      <Button size="xs">Extra Small</Button>
      <Button size="sm">Small</Button>
      <Button size="default">Default</Button>
      <Button size="lg">Large</Button>
      <Button size="icon">
        <PlusIcon />
      </Button>
    </div>
  );
}

Render Prop ​

The render prop lets you use the button's styles on a custom element:

tsx
function RenderProp() {
  return (
    <Button render={<Link to="/components/table" />} variant="outline">
      View Table documentation
    </Button>
  );
}

This is the Base UI render pattern — the button's class names and event handlers are applied to the rendered element.

Examples ​

Form Actions ​

tsx
function FormActions() {
  return (
    <div className="flex justify-end gap-2">
      <Button variant="outline">Cancel</Button>
      <Button>Save Changes</Button>
    </div>
  );
}

Destructive Confirmation ​

tsx
<Button variant="destructive" onClick={handleDelete}>
  Delete Order
</Button>

Icon Button ​

tsx
function IconButton() {
  return (
    <Button size="icon" variant="outline" aria-label="Add order">
      <PlusIcon aria-hidden />
    </Button>
  );
}

TypeScript ​

typescript
import { type ButtonProps } from "@tailor-platform/app-shell";

Styling ​

Use buttonVariants to apply button styles to non-button elements:

tsx
function StylingUtility() {
  return (
    <a href="/components/table" className={buttonVariants({ variant: "outline", size: "sm" })}>
      View Table documentation
    </a>
  );
}

Accessibility ​

  • Buttons render with cursor: pointer to signal interactivity consistently across all variants and sizes.
  • Disabled buttons suppress the pointer cursor via pointer-events-none, so they do not signal clickability.
  • Dialog - Use buttons as dialog triggers and actions
  • Sheet - Use buttons as sheet triggers
  • Layout - Use buttons in page header actions