# Empty state

Empty collections, search results and errors with a clear next action.

Access: pro. Category: Feedback. Kind: composite.

## When to use

- Use it when a page needs empty collections, search results and errors with a clear next action.
- Choose it when the host application can supply the required state and keep business logic outside the presentation component.

## Alternatives

- Choose empty-state-section instead when use the section for a large page region with supporting copy and primary next steps.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Empty state

```sh
npx shadcn@latest add @tidal-pro/empty-state
```

Stylesheets: `components/ui/tidal.css`, `components/ui/empty-state.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/empty-state.css";
import{TidalEmptyState}from"./components/ui/empty-state";
export default()=><div className="tidal-scope"><TidalEmptyState title={"Demo"}/></div>;
```

## Structured props

- `TidalEmptyState.title: ReactNode`: Required title value accepted by this exported component.
- `TidalEmptyState.actions?: ReactNode`: Optional actions value accepted by this exported component.
- `TidalEmptyState.announce?: boolean | undefined` (default false): Opt into a polite text-only announcement for a changing view.
- `TidalEmptyState.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalEmptyState.headingLevel?: "h2" | "h3" | "h4" | undefined` (default "h3"): Optional heading level value accepted by this exported component.
- `TidalEmptyState.variant?: TidalEmptyStateVariant | undefined` (default "empty"): Optional variant value accepted by this exported component.
- `TidalEmptyState.visual?: ReactNode`: Optional visual value accepted by this exported component.
- `TidalEmptyStateAction.variant?: "primary" | "secondary" | undefined` (default "empty"): Optional variant value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/empty-state.tsx) | [Manifest](https://tidalui.com/examples/empty-state.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useEffect, useRef, useState } from "react";

import { Folder, FolderPlus, ArrowRight, SearchX, RotateCcw, LoaderCircle, Check } from "lucide-react";

import { TidalEmptyState, TidalEmptyStateAction, type TidalEmptyStateVariant } from "./components/ui/empty-state";

import { TidalSegmentedControl } from "./components/ui/segmented-control";

import "./components/ui/empty-state.css";

import "./components/ui/segmented-control.css";



const tidalExampleStyles = "@import \"./components/segmented-control.css\";\n\n.tidal-scope .empty-state-specimen{width:100%;max-width:660px;padding:24px;border:1px solid var(--t-border);border-radius:var(--t-radius-card);background:var(--t-subtle);color:var(--t-ink);box-shadow:0 22px 40px -30px #00000030}.tidal-scope .empty-demo-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px;font-size:12px}.tidal-scope .empty-demo-toolbar>span:first-child{display:flex;align-items:center;gap:8px}.tidal-scope .empty-demo-toolbar strong{font-weight:600}.tidal-scope .empty-demo-toolbar>span:last-child{color:var(--t-muted);font-size:11px;font-variant-numeric:tabular-nums}\n.tidal-scope .empty-state-specimen .tidal-empty-state{min-height:330px}.tidal-scope .empty-demo-controls{display:flex;align-items:center;gap:10px;margin-top:18px}.tidal-scope .empty-demo-controls .tidal-segments{flex:1;min-width:0}.tidal-scope .empty-demo-controls>button{display:grid;place-items:center;flex:none;width:44px;height:44px;border:1px solid var(--t-border);border-radius:var(--t-radius-control);background:var(--t-surface);color:var(--t-ink);cursor:pointer;transition:background 140ms,transform 140ms var(--t-ease-out)}.tidal-scope .empty-demo-controls>button:hover{background:var(--t-wash)}.tidal-scope .empty-demo-controls>button:active{transform:scale(.98)}\n.tidal-scope .empty-demo-created{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;min-height:330px;padding:32px 24px;border:1px solid var(--t-border);border-radius:var(--t-radius-card);background:var(--t-surface)}.tidal-scope .empty-demo-created-icon{position:relative;display:grid;place-items:center;width:64px;height:64px;border:1px solid var(--t-border);border-radius:17px;background:var(--t-subtle);margin-bottom:20px}.tidal-scope .empty-demo-created-icon>svg:last-child{position:absolute;right:-5px;bottom:-5px;box-sizing:content-box;padding:5px;border:3px solid var(--t-surface);border-radius:9px;background:var(--t-ink);color:var(--t-surface)}.tidal-scope .empty-demo-created>h3{font-size:22px;letter-spacing:-.6px;font-weight:500;line-height:1.3;margin:0;overflow-wrap:anywhere}.tidal-scope .empty-demo-created>p{font-size:12px;color:var(--t-muted);line-height:1.6;margin:10px 0 22px;overflow-wrap:anywhere}.tidal-scope .empty-demo-note{margin:15px 0 0;color:var(--t-muted);font-size:11px;line-height:1.6}.tidal-scope .empty-demo-created>h3:focus{outline:2px solid var(--t-accent);outline-offset:5px;border-radius:3px}\n@keyframes tidal-empty-demo-enter{from{opacity:0;transform:translateY(6px) scale(.98)}to{opacity:1;transform:none}}@keyframes tidal-empty-demo-spin{to{transform:rotate(360deg)}}\n.tidal-scope .empty-demo-controls .tidal-segments>button{min-width:44px;min-height:44px;padding-inline:6px;font-size:11px;white-space:nowrap}\n@media(prefers-reduced-motion:no-preference){.tidal-scope .empty-demo-created{animation:tidal-empty-demo-enter 400ms var(--t-ease-out) both}.tidal-scope .empty-demo-toolbar>span:last-child{animation:tidal-empty-demo-enter 260ms var(--t-ease-out)}.tidal-scope .empty-demo-spinner{animation:tidal-empty-demo-spin 900ms linear infinite}}\n@media(max-width:480px){.tidal-scope .empty-state-specimen{padding:18px}.tidal-scope .empty-state-specimen .tidal-empty-state{padding:26px 18px}.tidal-scope .empty-demo-created{padding:26px 18px}.tidal-scope .empty-demo-controls{gap:8px}}\n@media(prefers-reduced-motion:reduce){.tidal-scope .empty-demo-controls>button:active{transform:none}}";

const states = {
  empty: { title:"No projects yet",description:"Create a sample project to keep related work together.",action:"Create sample project",Icon:FolderPlus },
  search: { title:"No matching projects",description:"No sample projects match “Budget”. Clear the search to start again.",action:"Clear sample search",Icon:SearchX },
  error: { title:"Projects couldn’t be loaded",description:"A simulated error. Try again to return to the empty collection.",action:"Try sample again",Icon:RotateCcw },
};

export function EmptyStateDemo(){
  const [mode,setMode]=useState<TidalEmptyStateVariant>("empty"),[created,setCreated]=useState(false),[busy,setBusy]=useState(false);
  const timer=useRef<ReturnType<typeof setTimeout>|undefined>(undefined),action=useRef<HTMLButtonElement>(null),heading=useRef<HTMLHeadingElement>(null),focusNext=useRef<"action"|"heading"|null>(null);
  useEffect(()=>()=>clearTimeout(timer.current),[]);
  useEffect(()=>{if(focusNext.current==="heading")heading.current?.focus({preventScroll:true});if(focusNext.current==="action")action.current?.focus({preventScroll:true});focusNext.current=null;},[created]);
  function change(value:string){clearTimeout(timer.current);setBusy(false);setCreated(false);setMode(value as TidalEmptyStateVariant);}
  function reset(){clearTimeout(timer.current);setBusy(false);setMode("empty");if(created)focusNext.current="action";setCreated(false);}
  function activate(){if(busy)return;if(mode==="search"){setMode("empty");return;}if(mode==="error"){setBusy(true);timer.current=setTimeout(()=>{setBusy(false);setMode("empty");},650);return;}focusNext.current="heading";setCreated(true);}
  const data=states[mode];
  return <div className="empty-state-specimen" data-mode={mode} data-created={created}>
    <div className="empty-demo-toolbar"><span><Folder size={16} aria-hidden="true" /><strong>Projects</strong></span><span key={String(created)}>{created?"1 project":"0 projects"}</span></div>
    {created?<div className="empty-demo-created"><span className="empty-demo-created-icon" aria-hidden="true"><Folder size={25}/><Check size={13}/></span><h3 ref={heading} tabIndex={-1}>Untitled project</h3><p role="status">Sample project created in this preview.</p><TidalEmptyStateAction variant="secondary" onClick={reset}>Remove sample project<RotateCcw size={15} aria-hidden="true" /></TidalEmptyStateAction></div>:<TidalEmptyState title={data.title} description={busy?"Retrying this local sample. No request is sent.":data.description} variant={mode} announce actions={<TidalEmptyStateAction ref={action} aria-disabled={busy} aria-busy={busy} onClick={activate}>{busy?<LoaderCircle className="empty-demo-spinner" size={15} aria-hidden="true" />:<data.Icon size={15} aria-hidden="true"/>}{busy?"Retrying sample":data.action}{!busy&&mode==="empty"?<ArrowRight size={14} aria-hidden="true"/>:null}</TidalEmptyStateAction>}/>}
    <div className="empty-demo-controls"><TidalSegmentedControl label="Preview state" value={mode} onValueChange={change} options={[{value:"empty",label:"Empty"},{value:"search",label:"Search"},{value:"error",label:"Error"}]}/><button type="button" onClick={reset} aria-label="Reset empty state preview"><RotateCcw size={15} aria-hidden="true"/></button></div>
    <p className="empty-demo-note">Sample collection. Projects and searches stay in this preview.</p>
  </div>;
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <EmptyStateDemo />
    </div>
  );
}

```

## Gotchas

- Install the declared registry dependencies and render inside a tidal-scope with the foundation stylesheet loaded.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Required visible title (ReactNode); optional description, actions and children for extra context. variant: empty(default), search or error controls decorative artwork and border treatment; consumers provide truthful corresponding text. headingLevel: h2, h3(default) or h4 should match the surrounding document. visual replaces the decorative folder art, or false removes it; custom visuals must be noninteractive because the visual slot is aria-hidden. Root forwards native div attributes/style/dir/className/ref. Optional announce(defaultfalse) places polite/status atomic semantics on the title/description only; actions and extra context remain outside this message. Static views stay silent. Consumers own data, loading, visibility, action effects and focus after replacing a view. No hidden state, timer, fetching, navigation or persistence is introduced. TidalEmptyStateAction forwards native button attributes/events/ref, defaults to type=button and supports explicit type=submit plus primary(default)/secondary variants. Native disabled remains native. For a real link use className='tidal-empty-action' and optional data-variant='secondary' to receive the same44px treatment; arbitrary custom action nodes are caller-styled. Guard handlers when using aria-disabled; that attribute alone does not block native activation. Long text wraps, actions stack in narrow containers, and original folder/icon geometry changes coordinate with the chosen variant. Scoped tidal.css/empty-state.css provide light/dark tokens, visible focus and finite entrance/variant motion, with static reduced-motion feedback. No sample project is created by the reusable component itself.
