# Snippet URL: /react/components/concepts/snippet Source: https://github.com/daangn/seed-design/blob/dev/docs/content/react/components/concepts/snippet.mdx Learn how to boost development efficiency by providing frequently used UI patterns as snippets. ## Overview Snippet is a solution to optimize developer experience (DX) while adopting Compound Components as the default. It's a pattern that helps you use complex compound components easily. ## Compound Components In the traditional closed component approach, component customization was limited. For example, with a closed component like: ```tsx Click me ``` The internal implementation was hidden, making it difficult to meet customization requirements like: - How to add styles to the label - How to change the checkbox icon - How to pass refs to div and input separately To solve these issues, we adopted the compound components pattern: ```tsx Click me ``` ## Why Snippet matters Compound components provide excellent flexibility, but writing such detailed implementations each time can be tedious. To solve this trade-off between flexibility and DX, the Snippet concept was introduced. ## Using Snippet ### Run CLI You can add snippets of required components to your project using the following command: ```bash npx @seed-design/cli add ``` Learn more about CLI commands. ### Using generated snippets After running CLI, snippets are created in the `seed-design/ui/*` directory. For example: ```tsx // seed-design/ui/checkbox.tsx export const Checkbox = React.forwardRef( ({ inputProps, rootRef, label, variant = "square", ...otherProps }, ref) => { return ( : null} checked={} indeterminate={} /> {label} ); } ); ``` ### Using it Through Snippet, you can use complex compound components simply: ```tsx import { Checkbox } from "@/seed-design/ui/checkbox"; const Demo = () => Click me; ```