Overview of Free Shadcn UI Blocks
mastershadcn/ui, Tailwind CSS, and React. These blocks are ready-to-use components built as an expansion of the standard shadcn/ui library. You can browse the available blocks at the official website.repository·master·Indexed 18 days ago
https://github.com/shadcnblocks/shadcn-ui-blocksA collection of 55 free, ready-to-use marketing blocks built for React, Tailwind CSS, and shadcn/ui. The library is compatible with the official shadcn CLI and is built using Tailwind 4. It includes specialized components such as CodeBlock for syntax-highlighted code with Shiki, BackgroundLines for animated SVG effects, and various UI blocks like Changelog1.
shadcn/ui, Tailwind CSS, and React. These blocks are ready-to-use components built as an expansion of the standard shadcn/ui library. You can browse the available blocks at the official website.All blocks in this collection are compatible with the official shadcn CLI. You can use the CLI to download and integrate these blocks directly into your project. For detailed instructions on using the CLI with these blocks, refer to the official shadcnblocks CLI documentation.
https://docs.shadcnblocks.com/blocks/shadcn-cli/The blocks are built using Tailwind 4. To ensure proper styling and compatibility in your project, you should refer to the provided Tailwind configuration/globals file to get started with your setup.
https://www.shadcnblocks.com/tailwind/globals.cssThe ChartContainer uses the provided config to generate dynamic CSS variables. For every key in your config, it creates a CSS variable named --color-{key}.
This allows you to use these colors directly in your Recharts components (like Bar or Line) using the fill or stroke props with the var() function. The ChartStyle component handles the injection of these variables into the DOM, supporting both light and dark themes automatically.
// 1. Define config with keys matching your data
const config = {
desktop: {
label: "Desktop Users",
color: "#2563eb",
theme: {
dark: "#3b82f6"
}
}
} satisfies ChartConfig
// 2. Use the generated CSS variable in the chart
<ChartContainer config={config}>
<BarChart data={data}>
<Bar dataKey="desktop" fill="var(--color-desktop)" />
</BarChart>
</ChartContainer>The CodeBlockFilename component automatically selects an icon from react-icons/si based on the filename provided. It uses pattern matching (including extensions and specific filenames) to determine the correct icon.
Supported patterns include:
*.ts, *.js, *.py, *.css, *.md, etc.Dockerfile, package.json, components.json, tailwind.config.*, next.config.*.*.astro, *.module.css.You can override the automatic icon by passing an icon prop to CodeBlockFilename.
The CodeBlock component is a compound component designed to display syntax-highlighted code with support for multiple files, language switching, and copy-to-clipboard functionality. It uses a context-based pattern where the parent CodeBlock manages the state of the currently active language/file.
CodeBlock: The root provider. Requires a data array of CodeBlockData objects.CodeBlockHeader: A container for the top bar (tabs, selectors, copy button).CodeBlockFiles: A container for file tabs/indicators.CodeBlockFilename: Displays the icon and name of the currently active file.CodeBlockSelect: A wrapper around Radix UI Select to switch between languages/files.CodeBlockBody: The container for the actual code content.CodeBlockItem: The individual code display element for a specific language/file. It handles syntax highlighting via Shiki.CodeBlockCopyButton: A button that copies the code of the currently active item to the clipboard.import {
CodeBlock,
CodeBlockHeader,
CodeBlockFiles,
CodeBlockFilename,
CodeBlockSelect,
CodeBlockSelectTrigger,
CodeBlockSelectValue,
CodeBlockSelectContent,
CodeBlockSelectItem,
CodeBlockBody,
CodeBlockItem,
CodeBlockContent,
CodeBlockCopyButton
} from '@/components/kibo-ui/code-block';
const data = [
{ language: 'typescript', filename: 'index.ts', code: 'const x = 1;' },
{ language: 'bash', filename: 'install.sh', code: 'npm install' },
];
export function MyCodeBlock() {
return (
<CodeBlock data={data} defaultValue="typescript">
<CodeBlockHeader>
<CodeBlockFiles>
{data.map((item) => (
<CodeBlockFilename key={item.filename}>{item.filename}</CodeBlockFilename>
))}
</CodeBlockFiles>
<CodeBlockSelect>
<CodeBlockSelectTrigger>
<CodeBlockSelectValue />
</CodeBlockSelectTrigger>
<CodeBlockSelectContent>
{data.map((item) => (
<CodeBlockSelectItem key={item.language} value={item.language}>
{item.language}
</CodeBlockSelectItem>
))}
</CodeBlockSelectContent>
</CodeBlockSelect>
<CodeBlockCopyButton />
</CodeBlockHeader>
<CodeBlockBody>
{data.map((item) => (
<CodeBlockItem key={item.language} value={item.language}>
<CodeBlockContent language={item.language}>{item.code}</CodeBlockContent>
</CodeBlockItem>
))}
</CodeBlockBody>
</CodeBlock>
);
}The ChartContainer component is the primary wrapper for your charts. It provides the ChartContext required by tooltips and legends and injects CSS variables for colors based on your config. It uses RechartsPrimitive.ResponsiveContainer internally to ensure the chart scales correctly.
Props:
config: The ChartConfig object defining labels and colors.id: An optional string to uniquely identify the chart (used for CSS scoping).className: Additional classes for the container.children: Recharts components (e.g., BarChart, LineChart) wrapped in a ResponsiveContainer context.<ChartContainer config={chartConfig}>
<BarChart data={data}>
<Bar dataKey="desktop" fill="var(--color-desktop)" />
</BarChart>
</ChartContainer>The Toaster component is the global container responsible for rendering toast notifications. It uses the useToast hook to listen for new toast events and renders them within a ToastProvider. To use it, you should include the <Toaster /> component at a high level in your application (e.g., in your root layout) so that notifications can appear regardless of the current view.
Notifications are triggered via the useToast hook, which provides a toast() function to dispatch titles, descriptions, and actions.
import { Toaster } from "@/components/ui/toaster"
// In your root layout or App component
export default function Layout({ children }) {
return (
<>
{children}
<Toaster />
</>
)
}
// To trigger a toast in another component:
import { useToast } from "@/hooks/use-toast"
export function MyComponent() {
const { toast } = useToast()
return (
<button onClick={() => toast({
title: "Success",
description: "Your changes have been saved."
})}>
Show Toast
</button>
)
}The CodeBlockContent component renders the actual syntax-highlighted HTML using Shiki. It supports several configuration options to control how code is processed.
children: The raw code string.language: The BundledLanguage to use for highlighting.themes: An object defining light and dark themes (defaults to github-light and github-dark-default).syntaxHighlighting: Boolean to enable/disable highlighting (defaults to true). If false, it renders a fallback <pre><code> block.Note: This component uses dangerouslySetInnerHTML to inject the HTML generated by Shiki.
<CodeBlockContent
language="typescript"
themes={{ light: 'github-light', dark: 'github-dark' }}
>
const hello = 'world';
</CodeBlockContent>The MagicCard component accepts the following props to customize the hover effect:
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | (required) | The content to be rendered inside the card. |
gradientSize | number | 200 | The radius of the radial gradient in pixels. |
gradientColor | string | #262626 | The color used for the radial gradient center. |
gradientOpacity | number | 0.8 | The opacity of the gradient effect. |
gradientFrom | string | #9E7AFF | The starting color of the gradient transition. |
gradientTo | string | #FE8BBB | The ending color of the gradient transition. |
className | string | (none) | Additional CSS classes for the container div. |
...props | React.HTMLAttributes<HTMLDivElement> | (none) | All other standard HTML div attributes. |
The CodeBlockCopyButton provides a pre-configured button to copy the code of the currently active item in a CodeBlock context to the user's clipboard.
asChild: If true, the button will merge its functionality into the provided child element (useful for custom button components).onCopy: Callback function triggered when the copy is successful.onError: Callback function triggered if the copy fails.timeout: Duration in milliseconds to show the 'copied' state before reverting to the default icon (defaults to 2000).className: Standard CSS class names.<CodeBlockCopyButton
onCopy={() => console.log('Copied!')}
timeout={3000}
/>The Changelog1 component accepts the following props:
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | "Changelog" | The main heading for the section |
description | string | "Get the latest updates..." | The sub-heading text |
entries | ChangelogEntry[] | defaultEntries | An array of version update objects |
className | string | undefined | Additional CSS classes for the container |