Saltar al contenido principal

Callout

Enfatizar información importante. Guiar usuarios efectivamente.

Note
The CLI reads NACHUI_TOKEN from your shell first, then falls back to .env.local. Values in the shell always win.
1import { Callout } from '@/components/ui/callout';
2
3export function Default() {
4 return (
5 <Callout className="max-w-lg">
6 <Callout.Title>Note</Callout.Title>
7 <Callout.Content>
8 The CLI reads NACHUI_TOKEN from your shell first, then falls back to .env.local. Values in
9 the shell always win.
10 </Callout.Content>
11 </Callout>
12 );
13}

Instalación

pnpm dlx nachui add callout

Anatomía

1import { Callout } from '@/components/ui/callout';
1<Callout variant="info">
2 <Callout.Title>Nota</Callout.Title>
3 <Callout.Content>Este es un callout con información.</Callout.Content>
4</Callout>

Composición

Usa la siguiente composición para construir un Callout:
Callout
├── Callout.Title
└── Callout.Content

Variantes

info

Good to know
Preview deploys are kept for 30 days and then removed. Promote one to production if you need the URL to stay reachable.
1import { Callout } from '@/components/ui/callout';
2
3export function Info() {
4 return (
5 <Callout variant="info" className="max-w-lg">
6 <Callout.Title>Good to know</Callout.Title>
7 <Callout.Content>
8 Preview deploys are kept for 30 days and then removed. Promote one to production if you need
9 the URL to stay reachable.
10 </Callout.Content>
11 </Callout>
12 );
13}

warning

Breaking change in v3.0
Button no longer forwards the asChild prop. Wrap the child in Slot yourself before you upgrade, or the link inside it renders as a nested button.
1import { Callout } from '@/components/ui/callout';
2
3export function Warning() {
4 return (
5 <Callout variant="warning" className="max-w-lg">
6 <Callout.Title>Breaking change in v3.0</Callout.Title>
7 <Callout.Content>
8 Button no longer forwards the asChild prop. Wrap the child in Slot yourself before you
9 upgrade, or the link inside it renders as a nested button.
10 </Callout.Content>
11 </Callout>
12 );
13}

danger

This cannot be undone
Deleting a project removes its deploys, environment variables, and request logs. Custom domains are released and can be claimed by anyone.
1import { Callout } from '@/components/ui/callout';
2
3export function Danger() {
4 return (
5 <Callout variant="danger" className="max-w-lg">
6 <Callout.Title>This cannot be undone</Callout.Title>
7 <Callout.Content>
8 Deleting a project removes its deploys, environment variables, and request logs. Custom
9 domains are released and can be claimed by anyone.
10 </Callout.Content>
11 </Callout>
12 );
13}

success

Recommended
Since v2.3 the compiler memoizes render output for you. New code can drop manual useMemo and useCallback wrappers around cheap values.
1import { Callout } from '@/components/ui/callout';
2
3export function Success() {
4 return (
5 <Callout variant="success" className="max-w-lg">
6 <Callout.Title>Recommended</Callout.Title>
7 <Callout.Content>
8 Since v2.3 the compiler memoizes render output for you. New code can drop manual useMemo and
9 useCallback wrappers around cheap values.
10 </Callout.Content>
11 </Callout>
12 );
13}

Icono Personalizado

Puedes anular el icono por defecto pasando el prop icon a Callout.
1<Callout icon={<MiIconoPersonalizado />}>
2 <Callout.Title>Personalizado</Callout.Title>
3 <Callout.Content>Callout con icono personalizado</Callout.Content>
4</Callout>

Referencia de API

Callout

PropiedadTipoPor defectoDescripción
variant"default" | "info" | "warning" | "danger" | "success""default"Controla el estilo visual del callout.
iconReact.ReactNodeIcono personalizado opcional.
classNamestringNombres de clases adicionales.
childrenReact.ReactNodeCompone el callout con Title y Content.

Callout.Title

PropiedadTipoPor defectoDescripción
childrenReact.ReactNodeTexto del título del callout.
classNamestringNombres de clases adicionales.

Callout.Content

PropiedadTipoPor defectoDescripción
childrenReact.ReactNodeContenido principal del callout.
classNamestringNombres de clases adicionales.
¿Encontraste algo que mejorar?

¿Notaste un error, tipografía o detalle faltante en esta página? Ayúdanos a mejorar la documentación abriendo un issue en GitHub.

Crear un Issue
Ctrl+I