BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/nativeui/alert

Alert

nativeui/alert
FreeComponent

An alert component for React Native applications.

Live preview

live · rendered by the registry
Rendered by nativeui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://nativeui.ribbi.ch/r/alert.json

Source

registry/alert/alert.tsxnativeui.ribbi.ch/r/alert.json
1import * as React from "react";
2import { View, Text } from "react-native";
3import { cva, type VariantProps } from "class-variance-authority";
4
5import { cn } from "@/lib/utils";
6
7const alertVariants = cva("w-full rounded-xl border p-4 mb-4", {
8 variants: {
9 variant: {
10 default: "bg-background border-input",
11 destructive:
12 "border-destructive/50 bg-destructive/10 text-destructive dark:border-destructive",
13 success:
14 "border-green-500/50 bg-green-500/10 text-green-700 dark:text-green-500 dark:border-green-500",
15 warning:
16 "border-yellow-500/50 bg-yellow-500/10 text-yellow-700 dark:text-yellow-500 dark:border-yellow-500",
17 info: "border-blue-500/50 bg-blue-500/10 text-blue-700 dark:text-blue-500 dark:border-blue-500",
18 },
19 },
20 defaultVariants: {
21 variant: "default",
22 },
23});
24
25interface AlertProps
26 extends React.ComponentPropsWithoutRef<typeof View>,
27 VariantProps<typeof alertVariants> {
28 icon?: React.ReactNode;
29}
30
31function Alert({ className, variant, icon, children, ...props }: AlertProps) {
32 return (
33 <View
34 className={cn(alertVariants({ variant }), className)}
35 accessibilityRole="alert"
36 {...props}
37 >
38 {icon && <View className="mb-2">{icon}</View>}
39 <View className={cn(icon ? "pl-0" : "pl-0")}>{children}</View>
40 </View>
41 );
42}
43
44interface AlertTitleProps extends React.ComponentPropsWithoutRef<typeof Text> { }
45
46function AlertTitle({ className, ...props }: AlertTitleProps) {
47 return (
48 <Text
49 className={cn(
50 "text-lg font-semibold leading-none tracking-tight text-foreground mb-2",
51 className
52 )}
53 {...props}
54 />
55 );
56}
57
58interface AlertDescriptionProps
59 extends React.ComponentPropsWithoutRef<typeof Text> { }
60
61function AlertDescription({ className, ...props }: AlertDescriptionProps) {
62 return (
63 <Text
64 className={cn("text-base text-foreground opacity-90", className)}
65 {...props}
66 />
67 );
68}
69
70export {
71 Alert,
72 AlertTitle,
73 AlertDescription,
74 type AlertProps,
75 type AlertTitleProps,
76 type AlertDescriptionProps,
77};

What it pulls in

npm packages

  • react-native
  • class-variance-authority

Files it writes

  • registry/alert/alert.tsx

Facts

Registry
nativeui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-01
Last confirmed
yesterday

Go to the source

Docs on nativeui nativeui.ribbi.ch nativeui-org/ui on GitHub Raw registry item This item as JSON

More from nativeui

All 29 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordionnativeuiComponentsFree2 deps
Alert Dialogalert-dialognativeuiComponentsFree1 dep
AvataravatarnativeuiComponentsFree1 dep
BadgebadgenativeuiComponentsFree2 deps
BreadcrumbbreadcrumbnativeuiComponentsFree2 deps
ButtonbuttonnativeuiComponentsFree2 deps
CalendarcalendarnativeuiComponentsFree4 deps
CardcardnativeuiComponentsFree1 dep
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex