In this tutorial, we will create badge in next js 13 with shadcn ui. First you need to setup next js 13 with shadcn ui project.
how to use shadcn ui in next js 13
Before use badge in next js 13 with shadcn ui you need to install npx shadcn-ui add badge.
npx shadcn-ui add badge
or
npx shadcn-ui@latest add
Next 13 with Shadcn UI Badge Example
1. Create next js 13 with shadcn ui simple badge using shadcn-ui Badge component.
import { Badge } from "@/components/ui/badge"
export default function BadgeDemo() {
return <Badge>Badge</Badge>
}
2. next js 13 with shadcn ui badge with variant="secondary".
import { Badge } from "@/components/ui/badge"
export default function BadgeDemo() {
return <Badge variant="secondary">Secondary</Badge>
}
3. next js 13 with shadcn ui outline badge.
import { Badge } from "@/components/ui/badge"
export default function BadgeDemo() {
return <Badge variant="outline">Outline</Badge>
}
4. next js 13 with shadcn ui error destructive badge.
import { Badge } from "@/components/ui/badge"
export default function BadgeDemo() {
return <Badge variant="destructive">Destructive</Badge>
}
5. next js 13 with shadcn ui custom badge with success, warning.
import { Badge } from "@/components/ui/badge"
export default function BadgeDemo() {
return (
<div className="flex justify-center items-center gap-4 mt-20">
<Badge className="bg-green-600">success</Badge>
<Badge className="bg-yellow-600">warning</Badge>
<Badge className="bg-blue-600">primary</Badge>
</div>
)
}
Related Posts
create a accordion in nextjs 13 with shadcn ui
create sidebar in next 13 with shadcn ui
create footer section in next 13 with shadcn ui
create file upload in nextjs 13 with shadcn ui
next 13 with shadcn ui input field example
next 13 with shadcn ui cards example
next 13 with shadcn ui search bar example
next 13 with shadcn ui login page example
next 13 with shadcn ui sign up form example
next 13 with shadcn ui radio group example
next 13 with shadcn ui buttons example
next 13 with shadcn ui pagination example
next 13 with shadcn ui table example
next 13 with shadcn ui checkbox example
next 13 with shadcn ui dropdown menu example
how to use skeleton loading next 13 with shadcn ui
how to use data table next 13 with shadcn ui
how to use modal dialog next 13 with shadcn ui
how to use tabs next 13 with shadcn ui
how to use toggle switch next 13 with shadcn ui