### Install and run the development server
Source: https://github.com/adrielzimbril/spaceui/blob/main/README.md
Use pnpm to install dependencies and start the development server. After running these commands, open http://localhost:3000 in your browser.
```bash
pnpm install
pnpm dev
```
--------------------------------
### Install Core Dependencies with bun
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/docs/installation/manual.mdx
Install Base UI, Motion, and class utility dependencies using bun.
```bash
bun add @base-ui/react motion cn class-variance-authority lucide-react @tabler/icons-react
```
--------------------------------
### Prompt to start with Space Motion skill
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/docs/skills.mdx
Paste this prompt into your agent, swap the bracketed placeholders, and it installs the Space Motion skill before starting. The prompt instructs the agent to propose beats and copy, build a scrubbable page, use emoji and sounds on key actions, and export frame by frame.
```text
Hey! I want to make a [10-second] opener for my product [Product name]: [one line on what it does and who it's for].
First install the Space Motion skill and follow it for everything that moves:
npx shadcn@latest add https://www.spaceui.one/r/motion.json
Then:
1. Propose the beats and the copy, one line per scene, and wait for my OK before animating.
2. Build it as a scrubbable page with one clock (?t= jumps to a moment).
3. Use animated emoji from @usespaceui/emoji and sounds from @usespaceui/sounds on key actions only.
4. When I approve it, export it frame by frame in 4K 60fps, not by recording the screen.
```
--------------------------------
### Installation: primitives-menu
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/primitives/menu.mdx
Install the primitives-menu package to use the Menu components.
```bash
```
--------------------------------
### Install Core Dependencies with npm
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/docs/installation/manual.mdx
Install Base UI, Motion, and class utility dependencies using npm.
```bash
npm install @base-ui/react motion cn class-variance-authority lucide-react @tabler/icons-react
```
--------------------------------
### Install Components via shadcn CLI
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/registry/skills/space-motion/resources.md
Install components as source code using the shadcn CLI. The command adds the @spaceui/essentials package.
```bash
npx shadcn@latest add @spaceui/essentials
```
--------------------------------
### Install Lucide Icons
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/docs/fundamentals/iconography.mdx
Install the lucide-react package to use Lucide icons in headless primitives.
```bash
npm install lucide-react
```
--------------------------------
### Basic Drawer usage
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/primitives/drawer.mdx
A minimal Drawer example with a trigger, popup, header, panel, footer, and close button. Use this as a starting point for your own drawer implementation.
```tsx
OpenDrawer TitleDrawer DescriptionContentClose
```
--------------------------------
### Install Core Dependencies with pnpm
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/docs/installation/manual.mdx
Install Base UI, Motion, and class utility dependencies using pnpm.
```bash
pnpm add @base-ui/react motion cn class-variance-authority lucide-react @tabler/icons-react
```
--------------------------------
### useFullscreen usage example
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/use-fullscreen.mdx
Import the hook and create a ref for the target element. Pass the ref to useFullscreen to get the isFullscreen state and toggle function.
```tsx
import { useFullscreen } from '@/hooks/use-fullscreen'
const ref = React.useRef(null)
const { isFullscreen, toggle } = useFullscreen(ref)
```
--------------------------------
### Import and use slugifyHeadline
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/format-content.mdx
Import the slugifyHeadline function from '@/utils/format-content' and call it with a string to generate a URL-friendly slug. The example shows the input 'Getting Started with React!' returning 'getting-started-with-react'.
```tsx
import { slugifyHeadline } from '@/utils/format-content'
slugifyHeadline('Getting Started with React!') // => "getting-started-with-react"
```
--------------------------------
### Example Prompts with MCP
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/docs/mcp.mdx
Example natural language prompts to try with your AI assistant when MCP is active. These prompts demonstrate searching, building, and adding components via the MCP server.
```text
1. Search Space UI for animated tab primitives and install @spaceui/tabs.
2. Build a project settings view with 3 tabs: General, Members, and Billing.
3. Add a delete confirmation dialog using @spaceui/dialog with destructive styling.
```
--------------------------------
### Install a Space UI component with shadcn CLI
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/docs/registry.mdx
Install a component using the c-* naming pattern. No license key or account is required. Shared @spaceui/* primitives are resolved automatically as registry dependencies.
```bash
npx shadcn@latest add @spaceui/components-spaceui-c-alert-1
```
--------------------------------
### Install Core Dependencies with yarn
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/docs/installation/manual.mdx
Install Base UI, Motion, and class utility dependencies using yarn.
```bash
yarn add @base-ui/react motion cn class-variance-authority lucide-react @tabler/icons-react
```
--------------------------------
### Install Scroll Manifesto component
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/components/scroll-manifesto.mdx
Install the components-spaceui-scroll-manifesto package.
```bash
npm install components-spaceui-scroll-manifesto
```
--------------------------------
### EmptyMedia component API examples
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/primitives/empty.mdx
Two examples: one with variant="icon" and another with an Avatar component inside.
```tsx
JD
```
--------------------------------
### Install useCookieListener hook
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/use-cookie-listener.mdx
Use the component installation helper to add the hook to your project.
```tsx
```
--------------------------------
### Install Space Motion skill with shadcn CLI
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/docs/skills.mdx
Installs the Space Motion skill via the shadcn CLI into .agents/skills/, where agents discover it automatically.
```bash
npx shadcn@latest add @spaceui/motion
```
--------------------------------
### Usage examples for ThemeToggleButton and useThemeToggle
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/components/theme-toggle.mdx
Shows how to import and render the ThemeToggleButton component with props, and how to use the useThemeToggle hook to get theme state and toggle function.
```tsx
import { ThemeToggleButton } from '@/components/spaceui/theme-toggle'
export default function SpaceUI() {
return
}
```
```tsx
const { isDark, toggleTheme } = useThemeToggle({ variant: 'rectangle', start: 'left-right' })
```
--------------------------------
### Import PreviewCard components
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/primitives/preview-card.mdx
Import the PreviewCard components and a Button for use in the example.
```tsx
import { Button } from '@/components/ui/button'
import { PreviewCard, PreviewCardPopup, PreviewCardTrigger } from '@/components/ui/preview-card'
```
--------------------------------
### Space UI .cursorrules for Cursor & Windsurf
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/docs/installation/lovable.mdx
Save this .cursorrules file to guide AI assistants to use Space UI components, tokens, and installation commands.
```markdown
# Space UI Project Guidelines
You are an expert React 19 & Tailwind CSS v4 developer working with Space UI.
## Core Stack
- React 19 (Server & Client Components)
- Base UI headless primitives (@base-ui/react)
- Motion for fluid physics and micro-interactions (motion)
- Tailwind CSS v4 (@import "tailwindcss")
## Component Installation
When asked to add or use new UI components:
1. Always check if the component exists in the Space UI registry (@spaceui).
2. Install via shadcn CLI:
npx shadcn@latest add @spaceui/
3. Import from `@/components/ui/`
## Theming & Styling Rules
- Use semantic color tokens: `bg-background`, `text-foreground`, `border-border`, `bg-muted`, `text-muted-foreground`.
- Use squircle corner classes (`rounded-sm`, `rounded-md`, `rounded-lg`) for cards and dialogs.
- Use `relative isolate` on page wrappers to prevent portal z-index collisions.
- Reference documentation schemas from: https://www.spaceui.one/llms.txt
```
--------------------------------
### Menu usage example
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/primitives/menu.mdx
Compose a dropdown menu with trigger, popup, items, separators, groups, checkboxes, radio group, and submenu. The popup uses align="start" and sideOffset={4}.
```tsx
```
--------------------------------
### useWindowSize
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/use-window-size.mdx
Documentation for the useWindowSize hook, including its signature, return value, and usage example.
```APIDOC
## useWindowSize
### Description
Tracks the current viewport dimensions (width and height) and returns them as reactive values.
### Signature
```ts
useWindowSize(): { width: number; height: number }
```
### Parameters
None.
### Return Value
| Property | Type | Description |
| :------- | :------- | :--------------- |
| `width` | `number` | Viewport width. |
| `height` | `number` | Viewport height. |
### Example
```tsx
import { useWindowSize } from '@/hooks/use-window-size'
const { width, height } = useWindowSize()
```
```
--------------------------------
### Example prompt to trigger Space Motion skill
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/docs/skills.mdx
Example of describing a job to an agent; the matching skill (Space Motion) kicks in automatically.
```text
Make a 45-second launch video of our landing page, then export it in 4K.
```
--------------------------------
### useFirstVisit
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/use-first-visit.mdx
Documentation for the useFirstVisit hook, including its signature, parameters, return value, and usage example.
```APIDOC
## useFirstVisit(key)
### Description
Returns a boolean indicating whether the current user session is the first visit for the given key.
### Signature
```ts
useFirstVisit(key: string): boolean
```
### Parameters
- **key** (`string`) - Required - Visit key used to identify the first visit.
### Return Value
- **boolean** - `true` if it is the first visit, `false` otherwise.
### Example
```tsx
import { useFirstVisit } from '@/hooks/use-first-visit'
const isFirst = useFirstVisit('welcome_popup')
```
```
--------------------------------
### Install Tailwind CSS v4 and core dependencies
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/docs/installation/vite.mdx
Install Tailwind CSS v4, the Vite plugin, Base UI, Motion, and utility libraries as development and runtime dependencies.
```bash
pnpm add -D @tailwindcss/vite tailwindcss @types/node && pnpm add @base-ui/react motion cn class-variance-authority lucide-react @tabler/icons-react
```
```bash
npm install -D @tailwindcss/vite tailwindcss @types/node && npm install @base-ui/react motion cn class-variance-authority lucide-react @tabler/icons-react
```
```bash
yarn add -D @tailwindcss/vite tailwindcss @types/node && yarn add @base-ui/react motion cn class-variance-authority lucide-react @tabler/icons-react
```
```bash
bun add -d @tailwindcss/vite tailwindcss @types/node && bun add @base-ui/react motion cn class-variance-authority lucide-react @tabler/icons-react
```
--------------------------------
### Install Tabler Icons
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/docs/fundamentals/iconography.mdx
Install the @tabler/icons-react package to use Tabler icons in components and blocks.
```bash
npm install @tabler/icons-react
```
--------------------------------
### Usage example with link
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/components/status-badge.mdx
Renders a StatusBadge with status 'available', primary text 'Disponible', and a link as children.
```tsx
1 place restante pour ce mois-ci
```
--------------------------------
### Spinner
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/primitives/spinner.mdx
Documentation for the Spinner component, including installation, usage, and API reference.
```APIDOC
## Spinner
### Description
Displays an animated spinning ring while an action or page is loading, reassuring users that their request is being processed.
### Import
```tsx
import { Spinner } from '@/components/ui/spinner'
```
### Usage
```tsx
```
### Props
| Prop | Type | Default |
| --- | --- | --- |
| `className` | `string` | |
```
--------------------------------
### useMediaQuery
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/use-media-query.mdx
Documentation for the useMediaQuery hook, including its signature, parameters, return value, and usage example.
```APIDOC
## useMediaQuery
### Description
Evaluates a CSS media query and returns a boolean indicating whether the query matches the current viewport.
### Signature
```ts
useMediaQuery(query: string): boolean
```
### Parameters
- **query** (`string`) - Required - CSS media query string.
### Return Value
- **boolean** - True if the query matches, false otherwise.
### Example
```tsx
import { useMediaQuery } from '@/hooks/use-media-query'
const isMobile = useMediaQuery('(max-width: 640px)')
```
```
--------------------------------
### useMap
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/use-map.mdx
Documentation for the useMap hook, including its signature, parameters, return value, and usage example.
```APIDOC
## useMap
### Description
Creates a reactive Map collection state manager.
### Signature
```ts
const [map, actions] = useMap(initialEntries?: [K, V][]): [Map, UseMapActions]
```
### Parameters
- **initialEntries** (`[K, V][]`, optional, default `[]`) - Initial key-value pairs for the Map.
### Return Value
- **map** (`Map`) - Reactive Map instance.
- **actions** (`Object`) - Object containing methods to manipulate the map, including `set`, `delete`, `clear`, etc.
### Usage Example
```tsx
import { useMap } from '@/hooks/use-map'
const [map, actions] = useMap([['key', 'val']])
actions.set('key', 'newVal')
```
```
--------------------------------
### useFirstRender
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/use-first-render.mdx
Documentation for the useFirstRender hook, including its signature, parameters, return value, and usage example.
```APIDOC
## useFirstRender
### Description
Returns a boolean indicating whether the current render is the first render of the component.
### Signature
```ts
useFirstRender(): boolean
```
### Parameters
None.
### Return Value
- **boolean** - `true` only on the initial mount, `false` on subsequent renders.
### Example
```tsx
import { useFirstRender } from '@/hooks/use-first-render'
const isFirst = useFirstRender()
```
```
--------------------------------
### useClipboard usage example
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/use-clipboard.mdx
Import the hook and use it to copy text. The timeout option defaults to 2000 ms, after which the copied state resets.
```tsx
import { useClipboard } from '@/hooks/use-clipboard'
const { copy, copied } = useClipboard({ timeout: 2000 })
copy('Text to copy')
```
--------------------------------
### GradientFileUpload usage example
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/components/gradient-file-upload.mdx
Render the GradientFileUpload component with a variant, max size, upload duration, and file accepted callback.
```tsx
console.log('Selected:', file.name)}
/>
```
--------------------------------
### Import and render ChromaPalette
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/components/chroma-palette.mdx
Basic usage example showing how to import and render the ChromaPalette component with a count of 5 swatches.
```tsx
import { ChromaPalette } from '@/components/spaceui/chroma-palette'
export default function Example() {
return
}
```
--------------------------------
### DeployPipeline
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/interactions/deploy-pipeline.mdx
API reference for the DeployPipeline component, including its props and usage example.
```APIDOC
## DeployPipeline
### Description
A deploy pipeline component that auto-advances through a cycle of frames, updating steps and badges without user interaction. It supports optional pause on hover and speed adjustment.
### Props
| Prop | Type | Default | Description |
| :--- | :--- | :------ | :---------- |
| `steps` | `DeployPipelineStep[]` | sample | Steps rendered in the pipeline. |
| `cycle` | `DeployPipelineFrame[]` | sample | Keyframes the pipeline auto-advances through. |
| `autoPlay` | `boolean` | `true` | Auto-advance through `cycle` on a timer. |
| `pauseOnHover` | `boolean` | `true` | Pause auto-advance while the pointer is over the pipeline. |
| `speed` | `number` | `1` | Multiplier applied to each frame's duration. |
| `className` | `string` | - | Additional CSS classes for the outer card. |
### Usage Example
```tsx
import { DeployPipeline } from '@/components/interactions/deploy-pipeline'
```
```
--------------------------------
### Initialize Space UI preset with shadcn CLI
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/docs/installation/index.mdx
Run the init command to configure components.json, color variables, and squircle utility classes. Use the command for your package manager: pnpm, npm, yarn, or bun.
```bash
pnpm dlx shadcn@latest init https://www.spaceui.one/r/lib-style.json
```
```bash
npx shadcn@latest init https://www.spaceui.one/r/lib-style.json
```
```bash
yarn dlx shadcn@latest init https://www.spaceui.one/r/lib-style.json
```
```bash
bunx --bun shadcn@latest init https://www.spaceui.one/r/lib-style.json
```
--------------------------------
### Add Space UI components in Bolt.new
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/docs/installation/lovable.mdx
Install required primitives (dialog and button) using the shadcn add command.
```bash
npx shadcn@latest add https://www.spaceui.one/r/primitives-dialog.json https://www.spaceui.one/r/primitives-button.json -y
```
--------------------------------
### Import Drawer components
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/primitives/drawer.mdx
Import all Drawer components from the UI library. This is the required setup before using the Drawer in your application.
```tsx
import {
Drawer,
DrawerCreateHandle,
DrawerClose,
DrawerContent,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerMenu,
DrawerMenuCheckboxItem,
DrawerMenuGroup,
DrawerMenuGroupLabel,
DrawerMenuItem,
DrawerMenuRadioGroup,
DrawerMenuRadioItem,
DrawerMenuSeparator,
DrawerPanel,
DrawerPopup,
DrawerMenuTrigger,
DrawerTitle,
DrawerTrigger,
} from '@/components/ui/drawer'
```
--------------------------------
### HandleReel Component
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/components/handle-reel.mdx
Documentation for the HandleReel React component, including its props and usage example.
```APIDOC
## HandleReel
### Description
A slot-machine handle reel component that spins a vertical reel of names past a fixed prefix, highlights the centered handle as it decelerates, and settles with momentum. Built with Motion.
### Props
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `prefix` | `ReactNode` | `"ryna.me/"` | Static prefix displayed before the rolling handles. |
| `suffix` | `ReactNode` | `undefined` | Optional suffix displayed after the rolling handles. |
| `names` | `string[]` | Default names | Array of candidate names or handles to cycle through. |
| `finalName` | `string` | `"ryna"` | The final handle the reel lands on. |
| `rows` | `number` | `7` | Number of visible rows in the viewport. |
| `cycles` | `number` | `3` | Number of scroll cycles before settling. |
| `spinDuration` | `number` | `4` | Duration of the spin animation in seconds. |
| `highlightColor` | `string` | `"var(--primary, #6366f1)"` | Accent color pulsed when landed. |
| `loop` | `boolean` | `false` | Replay the reel automatically. |
| `loopDelay` | `number` | `2200` | Pause duration before replaying when `loop` is true. |
| `trigger` | `number` | `0` | Increment to restart the roll programmatically. |
| `onLand` | `function` | `undefined` | Callback fired when the reel settles on the final handle. |
### Usage Example
```tsx
import { HandleReel } from '@/components/spaceui/handle-reel'
export default function HeroSection() {
return
}
```
```
--------------------------------
### Import Context Menu components
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/primitives/context-menu.mdx
Import all Context Menu components from the UI library. This is the required setup before using the context menu in your component.
```tsx
import {
ContextMenu,
ContextMenuCheckboxItem,
ContextMenuGroup,
ContextMenuGroupLabel,
ContextMenuItem,
ContextMenuLinkItem,
ContextMenuPopup,
ContextMenuRadioGroup,
ContextMenuRadioItem,
ContextMenuSeparator,
ContextMenuSub,
ContextMenuSubPopup,
ContextMenuSubTrigger,
ContextMenuTrigger,
} from '@/components/ui/context-menu'
```
--------------------------------
### useCookie
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/use-cookie.mdx
Documentation for the useCookie hook, including parameters, return value, and usage example.
```APIDOC
## useCookie
### Description
Reactive cookie reader and setter. Returns a tuple with the current cookie value, a setter function, and a remover function.
### Parameters
| Parameter | Type | Default | Description |
| :------------- | :------- | :---------- | :--------------- |
| `name` | `string` | _required_ | Cookie name. |
| `initialValue` | `string` | `undefined` | Initial default. |
### Return Value
| Return Type | Description |
| :---------------------------------------------------- | :------------------ |
| `[string \| null, (val: string) => void, () => void]` | Tuple cookie state. |
### Usage Example
```tsx
import { useCookie } from '@/hooks/use-cookie'
const [theme, setTheme, removeTheme] = useCookie('theme', 'dark')
```
```
--------------------------------
### zonedStartOfDay
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/components/event-calendar.mdx
Returns the start of the day (midnight) in the given time zone.
```APIDOC
## zonedStartOfDay
### Description
Zoned midnight of the day containing the instant.
### Signature
`zonedStartOfDay(date: Date, timeZone: string) => TZDate`
### Parameters
- **date** (Date) - Required - The date.
- **timeZone** (string) - Required - The display time zone.
### Returns
`TZDate` representing zoned midnight.
```
--------------------------------
### Import Navigation Menu components
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/primitives/navigation-menu.mdx
Import all Navigation Menu components from the UI library. This is the required setup before using the component.
```tsx
import {
NavigationMenu,
NavigationMenuList,
NavigationMenuItem,
NavigationMenuTrigger,
NavigationMenuContent,
NavigationMenuPortal,
NavigationMenuPositioner,
NavigationMenuPopup,
NavigationMenuViewport,
NavigationMenuLink,
} from '@/components/ui/navigation-menu'
```
--------------------------------
### useIdle
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/use-idle.mdx
Documentation for the useIdle hook, including its signature, parameters, return value, and usage example.
```APIDOC
## useIdle
### Description
Returns a boolean indicating whether the user has been inactive for a specified timeout period.
### Signature
```ts
useIdle(timeout?: number): boolean
```
### Parameters
- **timeout** (`number`, optional, default: `60000`) - Idle threshold in milliseconds.
### Return Value
- **boolean** - `true` if the user is idle, `false` otherwise.
### Example
```tsx
import { useIdle } from '@/hooks/use-idle'
const isIdle = useIdle(5000)
```
```
--------------------------------
### EventCalendar with controlled events and week view
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/components/event-calendar.mdx
Use this snippet to render an EventCalendar with controlled events state. Pass events and onEventsChange for controlled state, or defaultEvents for uncontrolled. The calendar uses scrollMode="contained" by default, so give the root an explicit height (examples use h-[560px]). Event changes from drag, resize, or api.updateEvent go through onEventUpdate; return false to reject, nothing/true to accept, or { start, end, allDay } to adjust. Use onRangeChange to fetch remote events and apiRef for imperative control.
```tsx
import * as React from 'react'
import { EventCalendar } from '@/components/spaceui/event-calendar/event-calendar'
import { EventCalendarContent } from '@/components/spaceui/event-calendar/event-calendar-content'
import { EventCalendarNav } from '@/components/spaceui/event-calendar/event-calendar-nav'
import type { CalendarEvent } from '@/components/spaceui/event-calendar/event-calendar-types'
export default function SpaceUI() {
const [events, setEvents] = React.useState(initialEvents)
return (
)
}
```
--------------------------------
### ButtonSquircle
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/components/button-squircle.mdx
Documentation for the ButtonSquircle component, including its import, props, and usage example.
```APIDOC
## ButtonSquircle Component
### Description
A tactile squircle button component with dynamic curvature morphing on hover and polymorphic Base UI render support.
### Import
```tsx
import { Button } from '@/components/spaceui/button-squircle'
```
### Props
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `variant` | `'primary' \| 'secondary' \| 'destructive' \| 'outline' \| 'ghost' \| 'icon' \| 'link'` | `'primary'` | Visual styling variant |
| `size` | `'xs' \| 'sm' \| 'default' \| 'lg' \| 'icon-xs' \| 'icon-sm' \| 'icon' \| 'icon-lg'` | `'default'` | Dimensions and padding |
| `squircle` | `boolean` | `true` | Enables continuous curvature corner squircle mask |
| `render` | `React.ReactElement \| ((props: any) => React.ReactNode)` | - | Polymorphic Base UI render element (e.g. Next.js Link or ``) |
| `full` | `boolean` | `false` | Stretches button to 100% width (supports legacy `asFull`) |
| `icon` | `boolean` | `false` | Adjusts svg sizing behavior for pure icon content (supports legacy `asIcon`) |
| `pointer` | `boolean` | `false` | Applies explicit cursor-pointer styling (supports legacy `asPointer`) |
| `hover` | `boolean` | `false` | Subtle hover scale tactile feedback (supports legacy `whileTap`) |
### Example
```tsx
import { Button } from '@/components/spaceui/button-squircle'
export default function Example() {
return (
)
}
```
```
--------------------------------
### useScrollDevice usage example
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/use-scroll-device.mdx
Import the hook and destructure its return values. The options object sets threshold to 3 pixels and idleTimeout to 250 milliseconds.
```tsx
import { useScrollDevice } from '@/hooks/use-scroll-device'
const {
device,
direction,
directionX,
directionY,
isScrolling,
isDiagonal,
isScrollingUp,
isScrollingDown,
isScrollingLeft,
isScrollingRight,
deltaX,
deltaY,
} = useScrollDevice({ threshold: 3, idleTimeout: 250 })
```
--------------------------------
### useIsMounted usage example
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/use-is-mounted.mdx
Import useIsMounted from '@/hooks/use-is-mounted' and call it to get a function that returns a boolean indicating mount state. Use the returned function to conditionally update state only when the component is mounted.
```tsx
import { useIsMounted } from '@/hooks/use-is-mounted'
const isMounted = useIsMounted()
if (isMounted()) updateState()
```
--------------------------------
### useInputValue
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/use-input-value.mdx
Documentation for the useInputValue hook, including its parameters, return value, and usage example.
```APIDOC
## useInputValue
### Description
A React hook that provides a unified value binder for form inputs and textareas, supporting tuple destructuring, object spreading, and reset/clear actions.
### Signature
```ts
const [value, bind, { setValue, reset, clear }] = useInputValue(initialValue?: string)
```
### Parameters
| Parameter | Type | Default | Description |
| :------------- | :------- | :------ | :-------------------------------- |
| `initialValue` | `string` | `''` | Initial text value for the input. |
### Return Value
| Property | Type | Description |
| :----------------- | :--------------------------- | :-------------------------------------------------------------- |
| `[0]` (or `value`) | `string` | Current string value. |
| `[1]` (or `bind`) | `{ value, onChange }` | Ready-to-spread props object for `` or ``. |
| `[2]` | `{ setValue, reset, clear }` | Action helpers object. |
| `onChange` | `Function` | React change event handler. |
| `reset()` | `Function` | Resets field to `initialValue`. |
| `clear()` | `Function` | Clears field to empty string. |
### Usage Example
```tsx
import { useInputValue } from '@/hooks/use-input-value'
export default function SpaceUI() {
// Pattern 1: Tuple destructuring with binder
const [value, bind, { reset, clear }] = useInputValue('Space UI')
return
}
```
```
--------------------------------
### useScript
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/use-script.mdx
Documentation for the useScript hook, including its signature, parameters, return value, and usage example.
```APIDOC
## useScript
### Description
Dynamically loads an external script and returns its loading status.
### Signature
```ts
useScript(src: string): 'idle' | 'loading' | 'ready' | 'error'
```
### Parameters
- **src** (`string`) - Required - The URL of the script to load.
### Return Value
- **status** (`'idle' | 'loading' | 'ready' | 'error'`) - The current loading status of the script.
### Example
```tsx
import { useScript } from '@/hooks/use-script'
const status = useScript('https://example.com/lib.js')
```
```
--------------------------------
### Create a Next.js Project
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/docs/installation/nextjs.mdx
Initialize a new Next.js application with TypeScript, Tailwind CSS, ESLint, and the App Router. Choose the command for your package manager (pnpm, npm, yarn, or bun).
```bash
pnpm create next-app@latest my-app --typescript --tailwind --eslint --app
```
```bash
npx create-next-app@latest my-app --typescript --tailwind --eslint --app
```
```bash
yarn create next-app my-app --typescript --tailwind --eslint --app
```
```bash
bun create next-app my-app --typescript --tailwind --eslint --app
```
--------------------------------
### useHold
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/use-hold.mdx
Documentation for the useHold hook, including usage example, parameters, and return value.
```APIDOC
## useHold
### Description
Long-press hold gesture detector.
### Usage
```tsx
import { useHold } from '@/hooks/use-hold'
export default function SpaceUI({ onDelete }: { onDelete: () => void }) {
const bind = useHold(() => onDelete(), { delay: 600 })
return
}
```
### Parameters
- **callback** (`() => void`) - Required - Action callback.
- **options.delay** (`number`) - Optional, default `500` - Hold duration.
### Return Value
- **HTMLAttributes** - DOM event bindings.
```
--------------------------------
### useAutoHeight
Source: https://github.com/adrielzimbril/spaceui/blob/main/src/content/library/hooks/use-auto-height.mdx
Documentation for the useAutoHeight hook, including its parameters, return value, and usage example.
```APIDOC
## useAutoHeight
### Description
Measures the height of a container element using ResizeObserver and requestAnimationFrame, enabling smooth CSS transitions when content height changes.
### Parameters
| Parameter | Type | Default | Description |
| :-------- | :--------------- | :------ | :--------------- |
| `deps` | `DependencyList` | `[]` | Dependency list. |
### Return Value
| Property | Type | Description |
| :------- | :----------------------- | :----------------------- |
| `ref` | `RefObject` | Inner measurable ref. |
| `height` | `number` | Calculated height in px. |
### Usage Example
```tsx
import * as React from 'react'
import { useAutoHeight } from '@/hooks/use-auto-height'
export default function SpaceUI({ items }: { items: React.ReactNode }) {
const { ref, height } = useAutoHeight([items])
return (