# Plate

A surface for text that would otherwise sit on the desktop: a raised panel, a sunken readout or a title-bar caption tag.

Source: https://www.ui95.dev/ui/plate

## Examples

```tsx
import { Plate } from "@/components/ui/plate"

import type { ShowcaseDemo } from "../types"

const COPY = "Every window on this desktop is built from the registry. Install one and own the code."

export const demo: ShowcaseDemo = {
  span: "wide",
  variants: [
    {
      label: "raised",
      render: () => (
        <Plate asChild>
          <p className="text-xl leading-tight">{COPY}</p>
        </Plate>
      ),
    },
    {
      label: "sunken",
      render: () => (
        <Plate variant="sunken" asChild>
          <p className="text-xl leading-tight">C:\UI95&gt; READY</p>
        </Plate>
      ),
    },
    {
      label: "tag",
      render: () => (
        <Plate variant="tag" asChild className="self-start">
          <h3>Text on the desktop</h3>
        </Plate>
      ),
    },
    {
      label: "on the desktop",
      render: () => (
        <div className="flex flex-col gap-3 bg-desktop p-4">
          <Plate variant="tag" asChild className="self-start">
            <h3>About</h3>
          </Plate>
          <Plate asChild>
            <p className="text-xl leading-tight">{COPY}</p>
          </Plate>
        </div>
      ),
    },
  ],
}
```

## Installation

```bash
npx shadcn@latest add https://www.ui95.dev/r/plate.json
```

Run it in a Radix shadcn project that already has the UI95 theme.

Dependencies:

```bash
npm install cn class-variance-authority radix-ui
```

`components/ui/plate.tsx`

```tsx
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
import { Slot } from "radix-ui"
import * as React from "react"

const plateVariants = cva("pixel-border border-border", {
  variants: {
    variant: {
      raised:
        "bg-card px-3 py-2 text-card-foreground shadow-[inset_var(--pixel)_var(--pixel)_0_0_var(--bevel-glint),inset_calc(var(--pixel)*-1)_calc(var(--pixel)*-1)_0_0_var(--bevel-lo),var(--pixel)_var(--pixel)_0_0_var(--foreground)]",
      sunken:
        "bg-(--ink-1) px-3 py-2 text-(--ink-3) shadow-[inset_var(--pixel)_var(--pixel)_0_0_var(--ink-0),var(--pixel)_var(--pixel)_0_0_var(--bevel-shade)] dark:bg-(--ink-0) dark:shadow-[inset_var(--pixel)_var(--pixel)_0_0_var(--ink-2),var(--pixel)_var(--pixel)_0_0_var(--bevel-shade)]",
      tag: "bg-titlebar px-2 py-1 font-pixel text-[16px] leading-none text-titlebar-foreground uppercase",
    },
  },
  defaultVariants: {
    variant: "raised",
  },
})

function Plate({
  className,
  variant = "raised",
  asChild = false,
  ...props
}: React.ComponentProps<"div"> &
  VariantProps<typeof plateVariants> & {
    asChild?: boolean
  }) {
  const Comp = asChild ? Slot.Root : "div"
  return (
    <Comp
      data-slot="plate"
      data-variant={variant}
      className={cn(plateVariants({ variant, className }))}
      {...props}
    />
  )
}

export { Plate, plateVariants }
```

## API reference

### Plate

| Prop | Type | Default |
| --- | --- | --- |
| `variant` | `"raised" \| "sunken" \| "tag"` | `"raised"` |
| `asChild` | `boolean` | `false` |
