Alert
octane/alertFreeComponent
octane publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by octane on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://raw.githubusercontent.com/octanejs/octane/main/packages/shadcn/registry/alert.jsonSource
1// Base UI base alert — structure and cva strings from upstream `bases/base-ui/ui/alert.tsx`.2//3// Alert uses no headless primitive in any base, and this file's nine string literals were4// verified byte-identical to the React Aria base's `alert.tsrx`. That is a finding, not an5// assumption: the two bases DO diverge elsewhere (the Radix base's Skeleton is `bg-accent`6// where aria's is `bg-muted`), so identity is checked per component rather than inherited.7//8// Octane adaptations: `React.ComponentProps<'div'>` → the package's `DivProps`; no9// `"use client"` (octane has no Server Components). Pure template JSX, no consumer-children10// interleave, so every part uses the `@{ … }` shorthand.11import { cva, type VariantProps } from 'class-variance-authority';1213import { cn } from '@/lib/utils';14import type { DivProps } from '@/lib/types';1516export const alertVariants = cva(17 'group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*=\'size-\'])]:size-4',18 {19 variants: {20 variant: {21 default: 'bg-card text-card-foreground',22 destructive: 'bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current',23 },24 },25 defaultVariants: {26 variant: 'default',27 },28 },29);3031export interface AlertProps extends DivProps {32 variant?: VariantProps<typeof alertVariants>['variant'];33}3435export function Alert({ className, variant, ...props }: AlertProps) @{36 <div37 data-slot="alert"38 role="alert"39 className={cn(alertVariants({ variant }), className)}40 {...props}41 />42}4344export function AlertTitle({ className, ...props }: DivProps) @{45 <div46 data-slot="alert-title"47 className={cn(48 'font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground',49 className,50 )}51 {...props}52 />53}5455export function AlertDescription({ className, ...props }: DivProps) @{56 <div57 data-slot="alert-description"58 className={cn(59 'text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4',60 className,61 )}62 {...props}63 />64}6566export function AlertAction({ className, ...props }: DivProps) @{67// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from octane
All 44 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | octane | Components | Free | 2 deps | |
| Alert Dialogalert-dialog | octane | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | octane | Components | Free | no deps | |
| Avataravatar | octane | Components | Free | 1 dep | |
| Badgebadge | octane | Components | Free | 1 dep | |
| Breadcrumbbreadcrumb | octane | Components | Free | 1 dep | |
| Buttonbutton | octane | Components | Free | 2 deps | |
| Cardcard | octane | Components | Free | no deps |
