āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š shadcn/directory/adityakishore0/scrollx-ui/components/badge ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
<ComponentPreview name="badge-demo" className="" description="Interactive badge with default styling and animation" />
<Step>Copy and paste the following code into your project.</Step>
<p> <code>badge.tsx</code> </p> <ComponentSource name="badge" /><Step>Add util file</Step>
<p> <code>lib/utils.ts</code> </p> ```jsx import { ClassValue, clsx } from "clsx"; import { twMerge } from "tailwind-merge";export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); }
</Steps>
</TabsContent>
</Tabs>
<Step>Add Utilities</Step>
<p>
<code>tailwind.config.ts</code>
</p>
```tsx
module.exports = {
theme: {
extend: {
keyframes: {
shine: {
'0%': { 'background-position': '100%' },
'100%': { 'background-position': '-100%' },
},
},
animation: {
shine: 'shine 5s linear infinite',
},
},
},
plugins: [],
};
import { Badge } from "@/components/ui/badge";
<Badge variant="default" shiny={true}>Badge</Badge>
<Step>Default</Step>
<ComponentPreview name="badge-demo" className="" description="Default badge with primary color and shine effect" />
<Step>Secondary</Step>
<ComponentPreview name="badge-secondary" className="" description="Subtle badge with secondary color theme and shine" />
<Step>Destructive</Step>
<ComponentPreview name="badge-destructive" className="" description="High-contrast badge for warnings and errors" />
<Step>Outline</Step>
<ComponentPreview name="badge-outline" className="" description="Minimal badge with border and transparent background" />
The Badge component creates a customizable label with variant styling and optional shiny animation effect.
<PropsTable
rows={[
{
prop: "variant",
type: "default" | "secondary" | "destructive" | "outline",
default: "default",
description: "Controls the visual style of the badge."
},
{
prop: "shiny",
type: "boolean",
default: "false",
description: "Enables an animated shine effect."
},
{
prop: "shinySpeed",
type: "number",
default: "ā",
description: "Controls shine animation speed in seconds."
},
{
prop: "className",
type: "string",
default: "ā",
description: "Custom class names to style the badge."
},
{
prop: "...props",
type: "HTMLDivElement attributes",
default: "ā",
description: "Supports all standard div props and events."
}
]}
/>
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā