Empty
Qué mostrar cuando todavía no hay nada: una caja de ícono opcional de 40px, un título de 20px, una descripción corta y las próximas acciones.
Instalación
npx shadcn@latest add @sevenone/emptyUso
import {
Empty,
EmptyContent,
EmptyDescription,
EmptyHeader,
EmptyMedia,
EmptyTitle,
} from "@/components/ui/empty"Ejemplos
Con ícono
No Projects Yet
You have not created any projects yet. Get started by creating your first project.
Learn More
<Empty>
<EmptyHeader>
<EmptyMedia variant="icon">
<Folder aria-hidden="true" />
</EmptyMedia>
<EmptyTitle>No Projects Yet</EmptyTitle>
<EmptyDescription>
You have not created any projects yet. Get started by creating your first project.
</EmptyDescription>
</EmptyHeader>
<EmptyContent>
<div className="flex gap-2">
<Button>Create Project</Button>
<Button variant="outline">Import Project</Button>
</div>
</EmptyContent>
<Button variant="link" asChild>
<a href="/docs">Learn More <ExternalLink aria-hidden="true" /></a>
</Button>
</Empty>Con contorno
Agrega border para tener el contorno punteado.
No results
Try another search term or clear the filters.
<Empty className="border">
<EmptyHeader>
<EmptyTitle>No results</EmptyTitle>
<EmptyDescription>Try another search term or clear the filters.</EmptyDescription>
</EmptyHeader>
<EmptyContent>
<Button variant="outline">Clear filters</Button>
</EmptyContent>
</Empty>Accesibilidad
- Di qué está vacío y qué puede hacer la persona después, con palabras sencillas.
- El ícono es decoración, así que márcalo con aria-hidden.
- Si el estado vacío aparece después de una búsqueda, anuncia la cantidad de resultados con una región live.