Empty
tetra-ui/emptyFreeComponent
Displays an empty state.
Live preview
live · rendered by the registry
Rendered by tetra-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://tetra-ui.com/r/empty.jsonSource
1import { cva, type VariantProps } from "class-variance-authority";2import { Children, cloneElement } from "react";3import { View } from "react-native";4import { cn } from "@/lib/utils";5import { Text } from "./text";67// Types8type EmptyMediaProps = React.ComponentProps<typeof View> &9 VariantProps<typeof emptyMediaVariants>;1011// Components12export const Empty = ({13 className,14 ...props15}: React.ComponentProps<typeof View>) => {16 return (17 <View18 className={cn(19 "flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 text-balance rounded-xl border-dashed p-6 text-center",20 className21 )}22 data-slot="empty"23 {...props}24 />25 );26};2728export const EmptyHeader = ({29 className,30 ...props31}: React.ComponentProps<typeof View>) => {32 return (33 <View34 className={cn("flex max-w-sm flex-col items-center gap-0.5", className)}35 data-slot="empty-header"36 {...props}37 />38 );39};4041export const EmptyMedia = ({42 className,43 variant = "default",44 ...props45}: EmptyMediaProps) => {46 return (47 <View48 className={cn(emptyMediaVariants({ className, variant }))}49 data-slot="empty-icon"50 data-variant={variant}51 {...props}52 />53 );54};5556export const EmptyMediaIcon = ({57 children,58 ...props59}: React.ComponentProps<typeof View>) => {60 const child = Children.only(children);6162 if (!child) {63 if (__DEV__) {64 throw new Error(65 "EmptyMediaIcon expects a single React element as children"66 );67 }68 return null;69 }7071 return cloneElement(72 child as React.ReactElement<React.ComponentProps<typeof View>>,73 {74 ...props,75 className: cn("size-4", props.className),76 }77 );78};7980export const EmptyTitle = ({81 className,82 ...props83}: React.ComponentProps<typeof Text>) => {84 return (85 <Text86 className={cn("font-medium text-base tracking-tight", className)}87 data-slot="empty-title"88 {...props}89 />90 );91};9293export const EmptyDescription = ({94 className,95 ...props96}: React.ComponentProps<typeof Text>) => {97 return (98 <Text99 className={cn(100 "text-center text-muted-foreground text-sm/relaxed [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",101 className102 )}103 data-slot="empty-description"104 {...props}105 />106 );107};108109export const EmptyContent = ({110 className,111 ...props112}: React.ComponentProps<typeof View>) => {113 return (114 <View115 className={cn(116// … truncated
What it pulls in
Other registry items
Files it writes
More from tetra-ui
All 41 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | tetra-ui | Components | Free | 1 dep | |
| Action Inputaction-input | tetra-ui | Components | Free | no deps | |
| Alertalert | tetra-ui | Components | Free | no deps | |
| Avataravatar | tetra-ui | Components | Free | no deps | |
| Badgebadge | tetra-ui | Components | Free | no deps | |
| Bottom Sheetbottom-sheet | tetra-ui | Components | Free | 4 deps · 7 files | |
| Buttonbutton | tetra-ui | Components | Free | no deps | |
| Cardcard | tetra-ui | Components | Free | no deps |
