# Clock

Real-time clock display with 12h/24h and date



<ComponentPreview base="ink" name="clock-demo" />

Installation [#installation]

<CodeTabs>
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add @termcn/clock
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource base="ink" name="clock" title="components/ui/clock.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</CodeTabs>

Usage [#usage]

```tsx
import { Clock } from "@/components/ui/clock";
```

```tsx
<Clock format="12h" showSeconds showDate timezone="America/New_York" />
```

API Reference [#api-reference]

Clock [#clock]

| Prop          | Type             | Default |
| ------------- | ---------------- | ------- |
| `format`      | `"12h" \| "24h"` | `"24h"` |
| `showSeconds` | `boolean`        | `true`  |
| `showDate`    | `boolean`        | `false` |
| `timezone`    | `string`         | -       |
| `color`       | `string`         | -       |
| `size`        | `"sm" \| "lg"`   | `"sm"`  |
