# canny-ui-react

Typed React component wrappers for the [Canny-UI](https://www.npmjs.com/package/canny-ui) design system.

Built on [Radix UI](https://www.radix-ui.com), [motion](https://motion.dev), [cmdk](https://cmdk.paco.me), and [lucide-react](https://lucide.dev). Component variants use the CSS classes in `canny-ui`. The optional `sx` prop uses inline styles for scalar values and scoped stylesheets for responsive values.

## Install

```bash
pnpm add canny-ui canny-ui-react
# or
npm install canny-ui canny-ui-react
```

Peer deps: `react` / `react-dom` >= 18.

The main entry supports tree shaking. You can also import individual component
families: `import { Button } from 'canny-ui-react/Button'`. Both paths share the
same implementation and overlay state. ESM and CommonJS are supported.

## Use

```tsx
import 'canny-ui/dist/canny-ui.min.css';
import {
  Button, ButtonGroup, FAB, IconButton,
  ToggleButton, ToggleButtonGroup, ToggleButtonGroupItem,
  Input, Textarea, Field,
  Select, SelectItem,
  MultiSelect,
  Checkbox, Radio, RadioGroup, Switch,
  Box, Stack, Row, Grid, Container, Divider, Spacer, Text,
  Card, Alert, Avatar, Progress, Skeleton,
  Navbar, Sidebar, Scroll,
} from 'canny-ui-react';

export function SignInCard() {
  return (
    <Container size="sm">
      <Card>
        <Stack gap={4}>
          <Text variant="h2">Welcome back</Text>
          <Field label="Email" required>
            <Input type="email" placeholder="name@company.com" />
          </Field>
          <Field label="Password" required>
            <Input type="password" showPasswordToggle />
          </Field>
          <Row gap={2} justify="end">
            <Button variant="ghost">Forgot?</Button>
            <Button>Sign in</Button>
          </Row>
        </Stack>
      </Card>
    </Container>
  );
}
```

## Highlights

- **Buttons** — 7 variants × 5 colors × 3 sizes × 3 shapes, click-position ripple powered by `motion`, `asChild` to render a router `<Link>` / `<a>` as a button, attached/spaced groups, FAB with spring entrance, Radix-powered toggles and segmented controls
- **Inputs** — prefix/suffix slots, clear button, password toggle, validation states wired through `<Field>`
- **Select / MultiSelect** — Radix Select + cmdk combobox with chip tokens, groups, descriptions, `maxItems` cap
- **Layout primitives** — `<Box>`, `<Stack>`, `<Row>`, `<Grid>`, `<Container>` map props to utility classes, polymorphic `as`
- **Typography** — `<Text variant="h1|h2|...|caption|code|kbd">` picks element + scale together
- **Application components** — DataTable, charts, DatePicker, dialogs, menus, CommandPalette, TreeView, file upload, and navigation

## Validation

From the repository root, run `pnpm check` for builds, unit tests, consumer bundle
budgets, and isolated tarball consumption. Run `pnpm test:browser` after installing
the Playwright browsers for keyboard, overlay, table, date, and accessibility
checks. See the root README for setup and the scope of these checks.

## Links

- **Docs**: https://canny-ui-docs.vercel.app
- **Issues**: https://github.com/CannyMinds/Canny-UI/issues
- **License**: MIT
