<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Shadcn UI Components, Blocks, Templates & Examples]]></title><description><![CDATA[Shadcn Space provides ready-to-use components, UI blocks, and templates that follow modern design practices. Everything is copy-paste friendly and built for rea]]></description><link>https://shadcn.hashnode.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1593680282896/kNC7E8IR4.png</url><title>Shadcn UI Components, Blocks, Templates &amp; Examples</title><link>https://shadcn.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Sep 2026 08:37:10 GMT</lastBuildDate><atom:link href="https://shadcn.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to Use Shadcn Checkbox in React and Next.js Projects]]></title><description><![CDATA[Checkboxes are one of the most commonly used form elements in modern web applications. They're useful for settings pages, task managers, surveys, forms, and anywhere users need to select one or more o]]></description><link>https://shadcn.hashnode.dev/how-to-use-shadcn-checkbox-in-react-and-next-js-projects</link><guid isPermaLink="true">https://shadcn.hashnode.dev/how-to-use-shadcn-checkbox-in-react-and-next-js-projects</guid><category><![CDATA[shadcn]]></category><category><![CDATA[checkbox]]></category><category><![CDATA[shadcn ui]]></category><category><![CDATA[shadcn ui component]]></category><category><![CDATA[how-to]]></category><dc:creator><![CDATA[ShadcnSpace]]></dc:creator><pubDate>Tue, 21 Jul 2026 13:05:03 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6a4f6aee79fe26ebb897f678/74c300ab-b34d-4206-8cb5-7a39d4ef2974.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Checkboxes are one of the most commonly used form elements in modern web applications. They're useful for settings pages, task managers, surveys, forms, and anywhere users need to select one or more options.</p>
<p>In this guide, you'll learn how to create a simple Shadcn Checkbox component using React, Next.js, and Tailwind CSS. We'll also look at how to install the component and customize it for your own projects.</p>
<h2>Install Shadcn Checkbox</h2>
<p>The easiest way to add the Checkbox component is with the Shadcn CLI.</p>
<pre><code class="language-javascript">pnpm dlx shadcn@latest add checkbox
</code></pre>
<p>After installation, you can import the component and use it as either a controlled or uncontrolled checkbox using <code>checked</code>, <code>onCheckedChange</code>, or <code>defaultChecked</code>.</p>
<h3>Manual Installation</h3>
<p>If you prefer to create the component manually, install the required dependency:</p>
<pre><code class="language-javascript">bun add @base-ui/react
</code></pre>
<p>Then create the Checkbox component using the code below.</p>
<pre><code class="language-javascript">"use client"

import * as React from "react"
import { CheckIcon } from "lucide-react"
import { Checkbox as CheckboxPrimitive } from "radix-ui"

import { cn } from "@/lib/utils"

function Checkbox({
  className,
  ...props
}: React.ComponentProps&lt;typeof CheckboxPrimitive.Root&gt;) {
  return (
    &lt;CheckboxPrimitive.Root
      data-slot="checkbox"
      className={cn(
        "peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",
        className
      )}
      {...props}
    &gt;
      &lt;CheckboxPrimitive.Indicator
        data-slot="checkbox-indicator"
        className="grid place-content-center text-current transition-none [&amp;&gt;svg]:size-3.5"
      &gt;
        &lt;CheckIcon /&gt;
      &lt;/CheckboxPrimitive.Indicator&gt;
    &lt;/CheckboxPrimitive.Root&gt;
  )
}

export { Checkbox }
</code></pre>
<img src="https://media1.giphy.com/media/v1.Y2lkPTc5MGI3NjExcXk0YndhZnY3M2kzMGU0YnEyYzcwbnRyajZvYnd2MnpjbXUwYXJ4cCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/8sY14s0EGTAJka6fiQ/giphy.gif" alt="Shadcn Official Checkbox" style="display:block;margin:0 auto" />

<p>Once the component is ready, you can reuse it anywhere in your application.</p>
<h2>Checkbox with Sizes</h2>
<p>Sometimes a single checkbox size isn't enough. Small checkboxes work well in tables, while larger ones are easier to tap on mobile devices.</p>
<p>Our <strong>Checkbox with Sizes</strong> component provides multiple size options that can be customized with Tailwind CSS.</p>
<h3>Install with CLI</h3>
<pre><code class="language-javascript">npx shadcn@latest add @shadcn-space/checkbox-01
</code></pre>
<h3>Manual Installation</h3>
<p>Or create it manually using the following code.</p>
<pre><code class="language-javascript">import { Checkbox } from '@/components/ui/checkbox'

const CheckboxSizesDemo = () =&gt; {
  return (
    &lt;div className='flex items-center gap-2'&gt;
      &lt;Checkbox defaultChecked aria-label='Size default' className='cursor-pointer' /&gt;
      &lt;Checkbox className='size-5 cursor-pointer' defaultChecked aria-label='Size small' /&gt;
      &lt;Checkbox className='size-6 cursor-pointer' defaultChecked aria-label='Size large' /&gt;
    &lt;/div&gt;
  )
}

export default CheckboxSizesDemo
</code></pre>
<img src="https://wpblog.wrappixel.com/wp-content/uploads/2026/07/Checkbox-01-Checkbox-with-sizes.gif" alt="Shadcn Checkbox with Multiple Sizes" style="display:block;margin:0 auto" />

<p>This example shows how to build three checkbox sizes using the same reusable component.</p>
<h3>Why use different checkbox sizes?</h3>
<ul>
<li><p>Small, medium, and large size options</p>
</li>
<li><p>Better experience on mobile devices</p>
</li>
<li><p>Easy to customize with Tailwind CSS</p>
</li>
<li><p>Works well across different layouts</p>
</li>
<li><p>Keeps your interface visually consistent</p>
</li>
</ul>
<p><strong>Best for:</strong> Responsive dashboards, mobile apps, admin panels, and data tables.</p>
<h2>Why Use Shadcn Checkbox?</h2>
<p>Shadcn Checkbox components are simple, flexible, and easy to integrate into React applications. They help you build consistent user interfaces without writing everything from scratch.</p>
<p>Some of the benefits include:</p>
<ul>
<li><p>Built with React, Next.js, and Tailwind CSS</p>
</li>
<li><p>Accessible and keyboard-friendly</p>
</li>
<li><p>Easy to customize with Tailwind classes</p>
</li>
<li><p>Works with controlled and uncontrolled state</p>
</li>
<li><p>Integrates well with React Hook Form and Zod</p>
</li>
<li><p>Lightweight and production-ready</p>
</li>
</ul>
<h2>Where Can You Use These Components?</h2>
<p>These checkbox components are useful for many types of applications, including:</p>
<ul>
<li><p>Forms</p>
</li>
<li><p>Settings pages</p>
</li>
<li><p>User preferences</p>
</li>
<li><p>Admin dashboards</p>
</li>
<li><p>SaaS products</p>
</li>
<li><p>Task management apps</p>
</li>
<li><p>Survey forms</p>
</li>
<li><p>Modern React and Next.js applications</p>
</li>
</ul>
<h2>Conclusion</h2>
<p>Building reusable checkbox components helps you create better user experiences while saving development time. Whether you need a simple checkbox or different size variants, these components are easy to customize and fit into almost any React or Next.js project.</p>
<p>Feel free to copy the examples, customize them to match your design system, and use them in your own applications.</p>
<p>In the next guide, we'll explore how to build reusable <strong>Shadcn Dialog Components</strong> with practical examples and ready-to-use code.</p>
]]></content:encoded></item></channel></rss>