35bcb63300
Componentes React accesibles basados en Radix UI con soporte de temas via CSS variables. Incluye barrel export en index.ts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2.7 KiB
2.7 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path, props, emits, has_state, framework, variant
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | tested | tests | test_file_path | file_path | props | emits | has_state | framework | variant | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| toast | component | ts | ui | 1.0.0 | impure | Toast(props: ToastProps): JSX.Element | Notificaciones temporales con variantes semanticas (success, error, warning, info), iconos automaticos, auto-dismiss y provider con hook useToast. |
|
|
false |
|
false | frontend/functions/ui/toast.tsx |
|
|
true | react |
|
Ejemplo
// 1. Envolver la app con el provider
<ToastProvider position="bottom-right">
<App />
</ToastProvider>
// 2. Usar el hook en cualquier componente
function MyComponent() {
const { toast } = useToast()
return (
<Button onClick={() => toast({
variant: "success",
title: "Guardado",
description: "Los cambios se guardaron correctamente.",
})}>
Guardar
</Button>
)
}
// Toast con accion
toast({
variant: "error",
title: "Error al guardar",
description: "Intenta de nuevo.",
action: <Button size="sm" variant="outline">Reintentar</Button>,
duration: 0, // persistente hasta cerrar manualmente
})
// Toast individual sin provider
<Toast variant="info" title="Informacion" description="Texto descriptivo" onClose={() => {}} />
Notas
Arquitectura: Toast (componente visual puro), ToastViewport (contenedor posicionado fixed), ToastProvider (context + logica de estado), useToast (hook consumidor). Los iconos son automaticos segun variante: CheckCircle2 (success), AlertCircle (error), AlertTriangle (warning), Info (info). El border-l-4 diferencia visualmente cada variante. ToastProvider acepta position con 6 posiciones predefinidas.