diff --git a/apps/v4/app/(app)/docs/[[...slug]]/page.tsx b/apps/v4/app/(app)/docs/[[...slug]]/page.tsx index 34aa1e0f05..49c018249c 100644 --- a/apps/v4/app/(app)/docs/[[...slug]]/page.tsx +++ b/apps/v4/app/(app)/docs/[[...slug]]/page.tsx @@ -79,7 +79,10 @@ export default async function Page(props: { const doc = page.data const MDX = doc.body - const neighbours = findNeighbour(source.pageTree, page.url) + const isChangelog = params.slug?.[0] === "changelog" + const neighbours = isChangelog + ? { previous: null, next: null } + : findNeighbour(source.pageTree, page.url) const raw = await page.data.getText("raw") return ( diff --git a/apps/v4/app/(app)/docs/changelog/page.tsx b/apps/v4/app/(app)/docs/changelog/page.tsx new file mode 100644 index 0000000000..0893562065 --- /dev/null +++ b/apps/v4/app/(app)/docs/changelog/page.tsx @@ -0,0 +1,140 @@ +import Link from "next/link" +import { Button } from "@/examples/radix/ui/button" +import { mdxComponents } from "@/mdx-components" +import { IconRss } from "@tabler/icons-react" + +import { getChangelogPages, type ChangelogPageData } from "@/lib/changelog" +import { absoluteUrl } from "@/lib/utils" +import { OpenInV0Cta } from "@/components/open-in-v0-cta" + +export const revalidate = false +export const dynamic = "force-static" + +export function generateMetadata() { + return { + title: "Changelog", + description: "Latest updates and announcements.", + openGraph: { + title: "Changelog", + description: "Latest updates and announcements.", + type: "article", + url: absoluteUrl("/docs/changelog"), + images: [ + { + url: `/og?title=${encodeURIComponent( + "Changelog" + )}&description=${encodeURIComponent( + "Latest updates and announcements." + )}`, + }, + ], + }, + } +} + +export default function ChangelogPage() { + const pages = getChangelogPages() + const latestPages = pages.slice(0, 5) + const olderPages = pages.slice(5) + + return ( +
+
+
+
+
+
+

+ Changelog +

+ +
+

+ Latest updates and announcements. +

+
+
+ {latestPages.map((page) => { + const data = page.data as ChangelogPageData + const MDX = page.data.body + + return ( +
+

+ {data.title} +

+
+ +
+
+ ) + })} + {olderPages.length > 0 && ( +
+

+ More Updates +

+
    + {olderPages.map((page) => { + const data = page.data as ChangelogPageData + return ( +
  • + + {data.title} + +
  • + ) + })} +
+
+ )} +
+
+
+
+
+
+
+

+ On This Page +

+ {latestPages.map((page) => { + const data = page.data as ChangelogPageData + return ( + + {data.title} + + ) + })} + {olderPages.length > 0 && ( + + More Updates + + )} +
+
+
+ +
+
+
+ ) +} diff --git a/apps/v4/app/layout.tsx b/apps/v4/app/layout.tsx index 480bb907c0..c7db90f7ac 100644 --- a/apps/v4/app/layout.tsx +++ b/apps/v4/app/layout.tsx @@ -57,6 +57,11 @@ export const metadata: Metadata = { apple: "/apple-touch-icon.png", }, manifest: `${siteConfig.url}/site.webmanifest`, + alternates: { + types: { + "application/rss+xml": `${siteConfig.url}/rss.xml`, + }, + }, } export default function RootLayout({ diff --git a/apps/v4/app/rss.xml/route.ts b/apps/v4/app/rss.xml/route.ts new file mode 100644 index 0000000000..a83241a23b --- /dev/null +++ b/apps/v4/app/rss.xml/route.ts @@ -0,0 +1,44 @@ +import { NextResponse } from "next/server" + +import { getChangelogPages, type ChangelogPageData } from "@/lib/changelog" +import { siteConfig } from "@/lib/config" + +export const revalidate = false + +export async function GET() { + const pages = getChangelogPages() + + const items = pages + .map((page) => { + const data = page.data as ChangelogPageData + const date = page.date?.toUTCString() ?? new Date().toUTCString() + const link = `${siteConfig.url}/docs/${page.slugs.join("/")}` + + return ` + <![CDATA[${data.title}]]> + ${link} + ${link} + + ${date} + ` + }) + .join("\n") + + const xml = ` + + + ${siteConfig.name} Changelog + ${siteConfig.url} + ${siteConfig.description} + en-us + +${items} + +` + + return new NextResponse(xml, { + headers: { + "Content-Type": "application/rss+xml; charset=utf-8", + }, + }) +} diff --git a/apps/v4/components/docs-sidebar.tsx b/apps/v4/components/docs-sidebar.tsx index e944be29ee..8c7e8d36ef 100644 --- a/apps/v4/components/docs-sidebar.tsx +++ b/apps/v4/components/docs-sidebar.tsx @@ -49,7 +49,7 @@ const TOP_LEVEL_SECTIONS = [ href: "/docs/changelog", }, ] -const EXCLUDED_SECTIONS = ["installation", "dark-mode"] +const EXCLUDED_SECTIONS = ["installation", "dark-mode", "changelog"] const EXCLUDED_PAGES = ["/docs", "/docs/changelog"] export function DocsSidebar({ diff --git a/apps/v4/content/docs/(root)/changelog.mdx b/apps/v4/content/docs/(root)/changelog.mdx deleted file mode 100644 index 4fa2aa0b94..0000000000 --- a/apps/v4/content/docs/(root)/changelog.mdx +++ /dev/null @@ -1,1673 +0,0 @@ ---- -title: Changelog -description: Latest updates and announcements. -toc: false ---- - -## January 2026 - Base UI Documentation - -We've shipped full documentation for Base UI components. - -
- - - - -
- -When we launched `npx shadcn create` in December, we introduced the ability to choose between Radix and Base UI as your component library. Today, we're following up with complete documentation for all Base UI components. - -### What's New - -- **Full Base UI docs** - Every component now has dedicated documentation for Base UI, covering usage, props, and examples. -- **Rebuilt examples** - All component examples have been rebuilt for both Radix and Base UI. Switch between them to see the implementation differences. -- **Side-by-side comparison** - The docs make it easy to compare how components work across both libraries. - -### Same Abstraction, Different Primitives - -The goal remains the same: give you a consistent API regardless of which primitive library you choose. The components look and behave the same way. Only the underlying implementation changes. - -```tsx -// Works the same whether you're using Radix or Base UI. -import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog" -``` - -If you're starting a new project, run `npx shadcn create` and pick your preferred library. The CLI handles the rest. - - - ---- - -## December 2025 - npx shadcn create - -From the very first commit, the goal of shadcn/ui was to make it customizable. - -The idea is to give you solid defaults, spacing, color tokens, animations, accessibility, and then let you take it from there. Tweak the code. Add new components. Change the colors. Build your own version. - -But somewhere along the way, all apps started looking the same. I guess the defaults were a little _too_ good. My bad. - -Today, we're changing that: **npx shadcn create**. - -Customize Everything. Pick your component library, icons, base color, theme, fonts and create your own version of shadcn/ui. - -We're starting with **5 new visual styles,** designed to help your UI actually feel like _your_ UI. - -- **Vega** – The classic shadcn/ui look. -- **Nova** – Reduced padding and margins for compact layouts. -- **Maia** – Soft and rounded, with generous spacing. -- **Lyra** – Boxy and sharp. Pairs well with mono fonts. -- **Mira** – Compact. Made for dense interfaces. - -**This goes beyond theming**. - -Your config doesn’t just change colors, it rewrites the component code to match your setup. Fonts, spacing, structure, even the libraries you use, everything adapts to your preferences. - -The new CLI takes care of it all. - -Start with a component library. Choose between Radix or Base UI. - -We rebuilt every component for Base UI, keeping the same abstraction. -They are fully compatible with your existing components, even those pulled from remote registries. - -When you pull down components, we auto-detect your library and apply the right transformations. - -**It's time to build something that doesn't look like everything else.** - -Now available for Next.js, Vite, TanStack Start and v0. - - - ---- - -## November 2025 - Registry directory - -We just published the Registry Directory: a list of code registries you can browse and pull code and components from. - -https://ui.shadcn.com/docs/directory - -Built into the CLI. No config required. - ---- - -## October 2025 - New Components - -For this round of components, I looked at what we build every day, the boring stuff we rebuild over and over, and made reusable abstractions you can actually use. - -**These components work with every component library, Radix, Base UI, React Aria, you name it. Copy and paste to your projects.** - -- [Spinner](#spinner): An indicator to show a loading state. -- [Kbd](#kbd): Display a keyboard key or group of keys. -- [Button Group](#button-group): A group of buttons for actions and split buttons. -- [Input Group](#input-group): Input with icons, buttons, labels and more. -- [Field](#field): One component. All your forms. -- [Item](#item): Display lists of items, cards, and more. -- [Empty](#empty): Use this one for empty states. - -### Spinner - -Okay let's start with the easiest ones: **Spinner** and **Kbd**. Pretty basic. We all know what they do. - -Here's how you render a spinner: - -```tsx -import { Spinner } from "@/components/ui/spinner" -``` - -```tsx - -``` - -Here's what it looks like: - - - -Here's what it looks like in a button: - - - -You can edit the code and replace it with your own spinner. - - - -### Kbd - -Kbd is a component that renders a keyboard key. - -```tsx -import { Kbd, KbdGroup } from "@/components/ui/kbd" -``` - -```tsx -Ctrl -``` - -Use `KbdGroup` to group keyboard keys together. - -```tsx showLineNumbers - - Ctrl - B - -``` - - - -You can add it to buttons, tooltips, input groups, and more. - -### Button Group - -I got a lot of requests for this one: Button Group. It's a container that groups related buttons together with consistent styling. Great for action groups, split buttons, and more. - - - -Here's the code: - -```tsx -import { ButtonGroup } from "@/components/ui/button-group" -``` - -```tsx showLineNumbers - - - - -``` - -You can nest button groups to create more complex layouts with spacing. - -```tsx showLineNumbers - - - - - - - - - - -``` - -Use `ButtonGroupSeparator` to create split buttons. Classic dropdown pattern. - - - -You can also use it to add prefix or suffix buttons and text to inputs. - - - -```tsx showLineNumbers - - Prefix - - - -``` - -### Input Group - -Input Group lets you add icons, buttons, and more to your inputs. You know, all those little bits you always need around your inputs. - -```tsx -import { - InputGroup, - InputGroupAddon, - InputGroupInput, -} from "@/components/ui/input-group" -``` - -```tsx showLineNumbers - - - - - - -``` - -Here's a preview with icons: - - - -You can also add buttons to the input group. - - - -Or text, labels, tooltips,... - - - -It also works with textareas so you can build really complex components with lots of knobs and dials or yet another prompt form. - - - -Oh here are some cool ones with spinners: - - - -### Field - -Introducing **Field**, a component for building really complex forms. The abstraction here is beautiful. - -It took me a long time to get it right but I made it work with all your form libraries: Server Actions, React Hook Form, TanStack Form, Bring Your Own Form. - -```tsx -import { - Field, - FieldDescription, - FieldError, - FieldLabel, -} from "@/components/ui/field" -``` - -Here's a basic field with an input: - -```tsx showLineNumbers - - Username - - - Choose a unique username for your account. - - -``` - - - -It works with all form controls. Inputs, textareas, selects, checkboxes, radios, switches, sliders, you name it. Here's a full example: - - - -Here are some checkbox fields: - - - -You can group fields together using `FieldGroup` and `FieldSet`. Perfect for -multi-section forms. - -```tsx showLineNumbers -
- - - - - -
-``` - - - -Making it responsive is easy. Use `orientation="responsive"` and it switches -between vertical and horizontal layouts based on container width. Done. - - - -Wait here's more. Wrap your fields in `FieldLabel` to create a selectable field group. Really easy. And it looks great. - - - -### Item - -This one is a straightforward flex container that can house nearly any type of content. - -I've built this so many times that I decided to create a component for it. Now I use it all the time. I use it to display lists of items, cards, and more. - -```tsx -import { - Item, - ItemContent, - ItemDescription, - ItemMedia, - ItemTitle, -} from "@/components/ui/item" -``` - -Here's a basic item: - -```tsx showLineNumbers - - - - - - Dashboard - Overview of your account and activity. - - -``` - - - -You can add icons, avatars, or images to the item. - - - - - -And here's what a list of items looks like with `ItemGroup`: - - - -Need it as a link? Use the `asChild` prop: - -```tsx showLineNumbers - - - - - - - Dashboard - Overview of your account and activity. - - - -``` - - - -### Empty - -Okay last one: **Empty**. Use this to display empty states in your app. - -```tsx -import { - Empty, - EmptyContent, - EmptyDescription, - EmptyMedia, - EmptyTitle, -} from "@/components/ui/empty" -``` - -Here's how you use it: - -```tsx showLineNumbers - - - - - No messages - You don't have any messages yet. - - - - -``` - - - -You can use it with avatars: - - - -Or with input groups for things like search results or email subscriptions: - - - -That's it. Seven new components. Works with all your libraries. Ready for your projects. - ---- - -## September 2025 - Registry Index - -We've created an index of open source registries that you can install items from. - -You can search, view and add items from the registry index without configuring the `.components.json` file. - -They'll be automatically added to your `components.json` file for you. - -```bash -npx shadcn add @ai-elements/prompt-input -``` - -The full list of registries is available at [https://ui.shadcn.com/r/registries.json](https://ui.shadcn.com/r/registries.json). - -To add a registry to the index, submit a PR to the `shadcn/ui` repository. See the [registry index documentation](/docs/registry/registry-index) for more details. - ---- - -## August 2025 - shadcn CLI 3.0 and MCP Server - -We just shipped shadcn CLI 3.0 with support for namespaced registries, advanced authentication, new commands and a completely rewritten registry engine. - -### What's New - -- [Namespaced Registries](#namespaced-registries) - Install components using `@registry/name` format. -- [Private Registries](#private-registries) - Secure your registry with advanced authentication. -- [Search & Discovery](#search--discovery) - New commands to find and view code before installing. -- [MCP Server](#mcp-server) - MCP server for all registries. -- [Faster Everything](#faster-everything) - Completely rewritten registry resolution. -- [Improved Error Handling](#improved-error-handling) - Better error messages for users and LLMs. -- [Upgrade Guide](#upgrade-guide) - Migration notes for existing users. - -### Namespaced Registries - -The biggest change in 3.0 is namespaced registries. You can now install components from registries: a community registry, your company's private registry or internal registry, using the `@registry/name` format. - -This makes it easier to distribute code across teams and projects. - -Configure registries in your `components.json`: - -```json title="components.json" -{ - "registries": { - "@acme": "https://acme.com/r/{name}.json", - "@internal": { - "url": "https://registry.company.com/{name}", - "headers": { - "Authorization": "Bearer ${REGISTRY_TOKEN}" - } - } - } -} -``` - -Then use the `@registry/name` format to install components: - -```bash -npx shadcn add @acme/button @internal/auth-system -``` - -It's completely decentralized. There's no central registrar. Create any namespace you want and organize components however makes sense for your team. - -```json title="components.json" showLineNumbers -{ - "registries": { - "@design": "https://registry.company.com/create/{name}.json", - "@engineering": "https://registry.company.com/eng/{name}.json", - "@marketing": "https://registry.company.com/marketing/{name}.json" - } -} -``` - -Components can even depend on resources from different registries. Everything gets resolved and installed automatically from the right sources. - -```json title="registry-item.json" showLineNumbers -{ - "name": "dashboard", - "type": "registry:block", - "registryDependencies": [ - "@shadcn/card", // From default registry - "@v0/chart", // From v0 registry - "@acme/data-table", // From acme registry - "@lib/data-fetcher", // Utility library - "@ai/analytics-prompt" // AI prompt resource - ] -} -``` - -### Private Registries - -Need to keep your components private? We've got you covered. Configure authentication with tokens, API keys, or custom headers: - -```json title="components.json" -{ - "registries": { - "@private": { - "url": "https://registry.company.com/{name}.json", - "headers": { - "Authorization": "Bearer ${REGISTRY_TOKEN}" - } - } - } -} -``` - -Your private components stay private. Perfect for enterprise teams with proprietary UI libraries. - -We support all major authentication methods: basic auth, bearer token, api key query params and custom headers. - -See the [authentication docs](/docs/registry/authentication) for more details. - -### Search & Discovery - -Three new commands make it easy to find exactly what you need: - -1. View items from the registry before installing - -```bash -npx shadcn view @acme/auth-system -``` - -2. Search items from registries - -```bash -npx shadcn search @tweakcn -q "dark" -``` - -3. List all items from a registry - -```bash -npx shadcn list @acme -``` - -Preview components before installing them. Search across multiple registries. See the code and all dependencies upfront. - -### MCP Server - -Lift Mode - -Back in April, we [introduced](https://x.com/shadcn/status/1917597228513853603) the first version of the MCP server. Since then, we've taken everything we learned and built a better MCP server. - -Here's what's new: - -- Works with all registries. Zero config -- One command to add to your favorite MCP clients -- We improved the underlying tools -- Better integration with the CLI and registries -- Support for multiple registries in the same project - -Add the MCP server to your project: - -```bash -npx shadcn@latest mcp init -``` - -See the [docs](/docs/mcp) for more details. - -### Faster Everything - -We completely rewrote the registry resolution engine from scratch. It's faster, smarter, and handles even the trickiest dependency trees. - -- Up to 3x faster dependency resolution -- Smarter file deduplication and merging -- Better monorepo support out of the box -- Updated `build` command for registry authors - -### Improved Error Handling - -Registry developers can now provide custom error messages to help guide users (and LLMs) when things go wrong. The CLI displays helpful, actionable errors for common issues: - -```txt -Unknown registry "@acme". Make sure it is defined in components.json as follows: -{ - "registries": { - "@acme": "[URL_TO_REGISTRY]" - } -} -``` - -Missing environment variables? The CLI tells you exactly what's needed: - -```txt -Registry "@private" requires the following environment variables: - • REGISTRY_TOKEN - -Set the required environment variables to your .env or .env.local file. -``` - -Registry authors can provide custom error messages in their responses to help users and AI agents understand and fix issues quickly. - -```txt -Error: -You are not authorized to access the item at http://example.com/r/component. - -Message: -[Unauthorized] Your API key has expired. Renew it at https://example.com/api/renew-key. -``` - -### Upgrade Guide - -Here's the best part: there are no breaking changes for users. Your existing `components.json` works exactly the same. All your installed components work exactly the same. - -For developers, if you're using the programmatic APIs directly, we've deprecated a few functions in favor of better ones: - -- `fetchRegistry` → `getRegistry` -- `resolveRegistryTree` → `resolveRegistryItems` -- Schema moved from `shadcn/registry` to `shadcn/schema` package - -```diff -- import { registryItemSchema } from "shadcn/registry" -+ import { registryItemSchema } from "shadcn/schema" -``` - -That's it. Seriously. Everything else just works. - ---- - -## July 2025 - Universal Registry Items - -We've added support for universal registry items. This allows you to create registry items that can be distributed to any project i.e. no framework, no components.json, no tailwind, no react required. - -This new registry item type unlocks a lot of new workflows. You can now distribute code, config, rules, docs, anything to any code project. - -See the [docs](/docs/registry/examples) for more details and examples. - ---- - -## July 2025 - Local File Support - -The shadcn CLI now supports local files. Initialize projects and add components, themes, hooks, utils and more from local JSON files. - -```bash -# Initialize a project from a local file -npx shadcn init ./template.json - -# Add a component from a local file -npx shadcn add ./block.json -``` - -This feature enables powerful new workflows: - -- **Zero setup** - No remote registries required -- **Faster development** - Test registry items locally before publishing -- **Enhanced workflow for agents and MCP** - Generate and run registry items locally -- **Private components** - Keep proprietary components local and private. - ---- - -## June 2025 - `radix-ui` - -We've added a new command to migrate to the new `radix-ui` package. This command will replace all `@radix-ui/react-*` imports with `radix-ui`. - -```bash -npx shadcn@latest migrate radix -``` - -It will automatically update all imports in your `ui` components and install `radix-ui` as a dependency. - -```diff showLineNumbers title="components/ui/alert-dialog.tsx" -- import * as AlertDialogPrimitive from "@radix-ui/react-dialog" -+ import { AlertDialog as AlertDialogPrimitive } from "radix-ui" -``` - -Make sure to test your components and project after running the command. - -**Note:** To update imports for newly added components, run the migration command again. - -## June 2025 - Calendar Component - -We've upgraded the `Calendar` component to the latest version of [React DayPicker](https://daypicker.dev). - -This is a major upgrade and includes a lot of new features and improvements. We've also built a collection of 30+ calendar blocks that you can use to build your own calendar components. - -See all calendar blocks in the [Blocks Library](/blocks/calendar) page. - -Calendar - -To upgrade your project to the latest version of the `Calendar` component, see the [upgrade guide](/docs/components/calendar#upgrade-guide). - -## May 2025 - New Site - -We've upgraded [ui.shadcn.com](https://ui.shadcn.com) to Next.js 15.3 and Tailwind v4. The site now uses the upgraded `new-york` components. - -We've also made some minor design updates to make the site faster and easier to navigate. - -This upgrade unlocks a lot of new features that we're working on. More to come. - -## April 2025 - MCP - -We're working on zero-config MCP support for shadcn/ui registry. One command `npx shadcn registry:mcp` to make any registry mcp-compatible. - -Lift Mode - -Learn more in the [thread here](https://x.com/shadcn/status/1917597228513853603). - -## March 2025 - shadcn 2.5.0 - -We tagged shadcn 2.5.0 earlier this week. It comes with a pretty cool feature: **resolve anywhere**. - -Registries can now place files anywhere in an app and we'll properly resolve imports. No need to stick to a fixed file structure. It can even add files outside the registry itself. - -On install, we track all files and perform a multi-pass resolution to correctly handle imports and aliases. It's fast. - -## March 2025 - Cross-framework Route Support - -The shadcn CLI can now auto-detect your framework and adapts routes for you. - -Works with all frameworks including Laravel, Vite and React Router. - -## February 2025 - Tailwind v4 - -We shipped the first preview of Tailwind v4 and React 19. Ready for you to try out. You can start using it today. - -What's New: - -- The CLI can now initialize projects with Tailwind v4. -- Full support for the new @theme directive and @theme inline option. -- All components are updated for Tailwind v4 and React 19. -- We've removed the forwardRefs and adjusted the types. -- Every primitive now has a data-slot attribute for styling. -- We've fixed and cleaned up the style of the components. -- We're deprecating the toast component in favor of sonner. -- Buttons now use the default cursor. -- We're deprecating the default style. New projects will use new-york. -- HSL colors are now converted to OKLCH. - -Read more in the [docs](/docs/tailwind-v4). - -## February 2025 - Updated Registry Schema - -We're updating the registry schema to support more features. - -Define code as a flat JSON file and distribute it via the CLI. - -- Custom styles: bring your own design system, components & tokens -- Extend, override, mix & match components from third-party registries and LLMs -- Install themes, CSS vars, hooks, animations, and Tailwind layers & utilities - -## January 2025 - Blocks - -We are inviting the community to contribute to the blocks library. Share your components and blocks with other developers and help build a library of high-quality, reusable components. - -We'd love to see all types of blocks: applications, marketing, products, and more. - -See the [docs](/docs/blocks) page to get started. - -## December 2024 - Monorepo Support - -Until now, using shadcn/ui in a monorepo was a bit of a pain. You could add -components using the CLI, but you had to manage where the components -were installed and manually fix import paths. - -With the new monorepo support in the CLI, we've made it a lot easier to use -shadcn/ui in a monorepo. - -The CLI now understands the monorepo structure and will install the components, -dependencies and registry dependencies to the correct paths and handle imports -for you. - -Read more in the [docs](/docs/monorepo). - -## November 2024 - Icons - -An update on icons. The new-york style now uses Lucide as the default icon set. - -- New projects will use Lucide by default -- No breaking changes for existing projects -- Use the CLI to (optionally) migrate primitives to Lucide - -For more info on why we're doing this, see the [thread](https://x.com/shadcn/status/1853902179041702169). - -## October 2024 - React 19 - -shadcn/ui is now compatible with React 19 and Next.js 15. - -We published a guide to help you upgrade your project to React 19. - -Read more [here](/docs/react-19). - -## October 2024 - Sidebar - -Introducing sidebar.tsx: 25 components to help you build all kinds of sidebars. - -I don't like building sidebars. So I built 30+ of them. All types. Then simplified the core into sidebar.tsx: a strong foundation to build on top of. - -It works with Next.js, Remix, Vite & Laravel. - -See the announcement [here](https://x.com/shadcn/status/1847359896557408461). - -## August 2024 - npx shadcn init - -The new CLI is now available. It's a complete rewrite with a lot of new features and improvements. You can now install components, themes, hooks, utils and more using `npx shadcn add`. - -This is a major step towards distributing code that you and your LLMs can access and use. - -1. First up, the cli now has support for all major React framework out of the box. Next.js, Remix, Vite and Laravel. And when you init into a new app, we update your existing Tailwind files instead of overriding. -2. A component now ship its own dependencies. Take the accordion for example, it can define its Tailwind keyframes. When you add it to your project, we'll update your tailwind.config.ts file accordingly. -3. You can also install remote components using url. `npx shadcn add https://acme.com/registry/navbar.json`. -4. We have also improve the init command. It does framework detection and can even init a brand new Next.js app in one command. `npx shadcn init`. -5. We have created a new schema that you can use to ship your own component registry. And since it has support for urls, you can even use it to distribute private components. -6. And a few more updates like better error handling and monorepo support. - -You can try the new cli today. - -```bash -npx shadcn init sidebar-01 login-01 -``` - -### Update Your Project - -To update an existing project to use the new CLI, update your `components.json` file to include import aliases for your **components**, **utils**, **ui**, **lib** and **hooks**. - -```json showLineNumbers {7-13} title="components.json" -{ - "$schema": "https://ui.shadcn.com/schema.json", - "style": "new-york", - "tailwind": { - // ... - }, - "aliases": { - "components": "@/components", - "utils": "@/lib/utils", - "ui": "@/components/ui", - "lib": "@/lib", - "hooks": "@/hooks" - } -} -``` - -If you're using a different import alias prefix eg `~`, replace `@` with your prefix. - -## April 2024 - Introducing Lift Mode - -We're introducing a new mode for [Blocks](/blocks) called **Lift Mode**. - -Enable Lift Mode to automatically "lift" smaller components from a block template for copy and paste. - - - Lift Mode - Lift Mode - View the blocks library - - -With Lift Mode, you'll be able to copy the smaller components that make up a block template, like cards, buttons, and forms, and paste them directly into your project. - -Visit the [Blocks](/blocks) page to try it out. - -## March 2024 - Introducing Blocks - -One of the most requested features since launch has been layouts: admin dashboards with sidebar, marketing page sections, cards and more. - -**Today, we're launching [**Blocks**](/blocks)**. - - - Admin dashboard - Admin dashboard - View the blocks library - - -Blocks are ready-made components that you can use to build your apps. They are fully responsive, accessible, and composable, meaning they are built using the same principles as the rest of the components in shadcn/ui. - -We're starting with dashboard layouts and authentication pages, with plans to add more blocks in the coming weeks. - -### Open Source - -Blocks are open source. You can find the source on GitHub. Use them in your projects, customize them and contribute back. - - - AI Playground - AI Playground - View the blocks library - - -### Request a Block - -We're also introducing a "Request a Block" feature. If there's a specific block you'd like to see, simply create a request on GitHub and the community can upvote and build it. - - - Settings Page - Settings Page - View the blocks library - - -### v0 - -If you have a [v0](https://v0.dev) account, you can use the **Edit in v0** feature to open the code on v0 for prompting and further generation. - -
- - - - -
- -That's it. _Looking forward to seeing what you build with Blocks_. - -## March 2024 - Breadcrumb and Input OTP - -We've added a new Breadcrumb component and an Input OTP component. - -### Breadcrumb - -An accessible and flexible breadcrumb component. It has support for collapsed items, custom separators, bring-your-own routing `` and composable with other shadcn/ui components. - - - -[See more examples](/docs/components/breadcrumb) - -### Input OTP - -A fully featured input OTP component. It has support for numeric and alphanumeric codes, custom length, copy-paste and accessible. Input OTP is built on top of [input-otp](https://github.com/guilhermerodz/input-otp) by [@guilherme_rodz](https://twitter.com/guilherme_rodz). - - - -[Read the docs](/docs/components/input-otp) - -If you have a [v0](https://v0.dev), the new components are available for generation. - -## December 2023 - New components, CLI and more - -We've added new components to shadcn/ui and made a lot of improvements to the CLI. - -Here's a quick overview of what's new: - -- [**Carousel**](#carousel) - A carousel component with motion, swipe gestures and keyboard support. -- [**Drawer**](#drawer) - A drawer component that looks amazing on mobile. -- [**Pagination**](#pagination) - A pagination component with page navigation, previous and next buttons. -- [**Resizable**](#resizable) - A resizable component for building resizable panel groups and layouts. -- [**Sonner**](#sonner) - The last toast component you'll ever need. -- [**CLI updates**](#cli-updates) - Support for custom **Tailwind prefix** and `tailwind.config.ts`. - -### Carousel - -We've added a fully featured carousel component with motion, swipe gestures and keyboard support. Built on top of [Embla Carousel](https://www.embla-carousel.com). - -It has support for infinite looping, autoplay, vertical orientation, and more. - - - -### Drawer - -Oh the drawer component 😍. Built on top of [Vaul](https://github.com/emilkowalski/vaul) by [emilkowalski](https://twitter.com/emilkowalski). - -Try opening the following drawer on mobile. It looks amazing! - - - -### Pagination - -We've added a pagination component with page navigation, previous and next buttons. Simple, flexible and works with your framework's `` component. - - - -### Resizable - -Build resizable panel groups and layouts with this `` component. - - - -`` is built using [react-resizable-panels](https://github.com/bvaughn/react-resizable-panels) by [bvaughn](https://github.com/bvaughn). It has support for mouse, touch and keyboard. - -### Sonner - -Another one by [emilkowalski](https://twitter.com/emilkowalski). The last toast component you'll ever need. Sonner is now availabe in shadcn/ui. - - - -### CLI updates - -This has been one of the most requested features. You can now configure a custom Tailwind prefix and the cli will automatically prefix your utility classes when adding components. - -This means you can now easily add shadcn/ui components to existing projects like Docusaurus, Nextra...etc. A drop-in for your existing design system with no conflict. 🔥 - -```tsx /tw-/ - -``` - -It works with `cn`, `cva` and CSS variables. - -The cli can now also detect `tailwind.config.ts` and add the TypeScript version of the config for you. - -That's it. Happy Holidays. - -## July 2023 - JavaScript - -This project and the components are written in TypeScript. **We recommend using TypeScript for your project as well**. - -However we provide a JavaScript version of the components, available via the [cli](/docs/cli). - -```txt -Would you like to use TypeScript (recommended)? no -``` - -To opt-out of TypeScript, you can use the `tsx` flag in your `components.json` file. - -```json {10} title="components.json" showLineNumbers -{ - "style": "default", - "tailwind": { - "config": "tailwind.config.js", - "css": "src/app/globals.css", - "baseColor": "zinc", - "cssVariables": true - }, - "rsc": false, - "tsx": false, - "aliases": { - "utils": "~/lib/utils", - "components": "~/components" - } -} -``` - -To configure import aliases, you can use the following `jsconfig.json`: - -```json {4} title="jsconfig.json" showLineNumbers -{ - "compilerOptions": { - "paths": { - "@/*": ["./*"] - } - } -} -``` - -## June 2023 - New CLI, Styles and more - -I have a lot of updates to share with you today: - -- [**New CLI**](#new-cli) - Rewrote the CLI from scratch. You can now add components, dependencies and configure import paths. -- [**Theming**](#theming-with-css-variables-or-tailwind-colors) - Choose between using CSS variables or Tailwind CSS utility classes for theming. -- [**Base color**](#base-color) - Configure the base color for your project. This will be used to generate the default color palette for your components. -- [**React Server Components**](#react-server-components) - Opt out of using React Server Components. The CLI will automatically append or remove the `use client` directive. -- [**Styles**](#styles) - Introducing a new concept called _Style_. A style comes with its own set of components, animations, icons and more. -- [**Exit animations**](#exit-animations) - Added exit animations to all components. -- [**Other updates**](#other-updates) - New `icon` button size, updated `sheet` component and more. -- [**Updating your project**](#updating-your-project) - How to update your project to get the latest changes. - ---- - -### New CLI - -I've been working on a new CLI for the past few weeks. It's a complete rewrite. It comes with a lot of new features and improvements. - -### `init` - -```bash -npx shadcn@latest init -``` - -When you run the `init` command, you will be asked a few questions to configure `components.json`: - -```txt showLineNumbers -Which style would you like to use? › Default -Which color would you like to use as base color? › Slate -Where is your global CSS file? › › app/globals.css -Do you want to use CSS variables for colors? › no / yes -Where is your tailwind.config.js located? › tailwind.config.js -Configure the import alias for components: › @/components -Configure the import alias for utils: › @/lib/utils -Are you using React Server Components? › no / yes -``` - -This file contains all the information about your components: where to install them, the import paths, how they are styled...etc. - -You can use this file to change the import path of a component, set a baseColor or change the styling method. - -```json title="components.json" showLineNumbers -{ - "style": "default", - "tailwind": { - "config": "tailwind.config.ts", - "css": "src/app/globals.css", - "baseColor": "zinc", - "cssVariables": true - }, - "rsc": false, - "aliases": { - "utils": "~/lib/utils", - "components": "~/components" - } -} -``` - -This means you can now use the CLI with any directory structure including `src` and `app` directories. - -### `add` - -```bash -npx shadcn@latest add -``` - -The `add` command is now much more capable. You can now add UI components but also import more complex components (coming soon). - -The CLI will automatically resolve all components and dependencies, format them based on your custom config and add them to your project. - -### `diff` (experimental) - -```bash -npx shadcn diff -``` - -We're also introducing a new `diff` command to help you keep track of upstream updates. - -You can use this command to see what has changed in the upstream repository and update your project accordingly. - -Run the `diff` command to get a list of components that have updates available: - -```bash -npx shadcn diff -``` - -```txt -The following components have updates available: -- button - - /path/to/my-app/components/ui/button.tsx -- toast - - /path/to/my-app/components/ui/use-toast.ts - - /path/to/my-app/components/ui/toaster.tsx -``` - -Then run `diff [component]` to see the changes: - -```bash -npx shadcn diff alert -``` - -```diff /pl-12/ -const alertVariants = cva( -- "relative w-full rounded-lg border", -+ "relative w-full pl-12 rounded-lg border" -) -``` - ---- - -### Theming with CSS Variables or Tailwind Colors - -You can choose between using CSS variables or Tailwind CSS utility classes for theming. - -When you add new components, the CLI will automatically use the correct theming methods based on your `components.json` configuration. - -#### Utility classes - -```tsx /bg-zinc-950/ /text-zinc-50/ /dark:bg-white/ /dark:text-zinc-950/ -
-``` - -To use utility classes for theming set `tailwind.cssVariables` to `false` in your `components.json` file. - -```json {6} title="components.json" showLineNumbers -{ - "tailwind": { - "config": "tailwind.config.js", - "css": "app/globals.css", - "baseColor": "slate", - "cssVariables": false - } -} -``` - -#### CSS Variables - -```tsx /bg-background/ /text-foreground/ -
-``` - -To use CSS variables classes for theming set `tailwind.cssVariables` to `true` in your `components.json` file. - -```json {6} title="components.json" showLineNumbers -{ - "tailwind": { - "config": "tailwind.config.js", - "css": "app/globals.css", - "baseColor": "slate", - "cssVariables": true - } -} -``` - ---- - -### Base color - -You can now configure the base color for your project. This will be used to generate the default color palette for your components. - -```json {5} title="components.json" showLineNumbers -{ - "tailwind": { - "config": "tailwind.config.js", - "css": "app/globals.css", - "baseColor": "zinc", - "cssVariables": false - } -} -``` - -Choose between `gray`, `neutral`, `slate`, `stone` or `zinc`. - -If you have `cssVariables` set to `true`, we will set the base colors as CSS variables in your `globals.css` file. If you have `cssVariables` set to `false`, we will inline the Tailwind CSS utility classes in your components. - ---- - -### React Server Components - -If you're using a framework that does not support React Server Components, you can now opt out by setting `rsc` to `false`. We will automatically append or remove the `use client` directive when adding components. - -```json title="components.json" showLineNumbers -{ - "rsc": false -} -``` - ---- - -### Styles - -We are introducing a new concept called _Style_. - -_You can think of style as the visual foundation: shapes, icons, animations & typography._ A style comes with its own set of components, animations, icons and more. - -We are shipping two styles: `default` and `new-york` (with more coming soon). - -Default vs New York style - -The `default` style is the one you are used to. It's the one we've been using since the beginning of this project. It uses `lucide-react` for icons and `tailwindcss-animate` for animations. - -The `new-york` style is a new style. It ships with smaller buttons, cards with shadows and a new set of icons from [Radix Icons](https://icons.radix-ui.com). - -When you run the `init` command, you will be asked which style you would like to use. This is saved in your `components.json` file. - -```json title="components.json" showLineNumbers -{ - "style": "new-york" -} -``` - -### Theming - -Start with a style as the base then theme using CSS variables or Tailwind CSS utility classes to completely change the look of your components. - -Style with theming - ---- - -### Exit animations - -I added exit animations to all components. Click on the combobox below to see the subtle exit animation. - - - -The animations can be customized using utility classes. - ---- - -### Other updates - -### Button - -- Added a new button size `icon`: - - - -### Sheet - -- Renamed `position` to `side` to match the other elements. - - - -- Removed the `size` props. Use `className="w-[200px] md:w-[450px]"` for responsive sizing. - ---- - -### Updating your project - -Since we follow a copy and paste approach, you will need to manually update your project to get the latest changes. - - - Note: we are working on a [`diff`](#diff-experimental) command to help you - keep track of upstream updates. - - - - -### Add `components.json` - -Creating a `components.json` file at the root: - -```json title="components.json" showLineNumbers -{ - "style": "default", - "rsc": true, - "tailwind": { - "config": "tailwind.config.js", - "css": "app/globals.css", - "baseColor": "slate", - "cssVariables": true - }, - "aliases": { - "components": "@/components", - "utils": "@/lib/utils" - } -} -``` - -Update the values for `tailwind.css` and `aliases` to match your project structure. - -### Button - -Add the `icon` size to the `buttonVariants`: - -```tsx {7} title="components/ui/button.tsx" showLineNumbers -const buttonVariants = cva({ - variants: { - size: { - default: "h-10 px-4 py-2", - sm: "h-9 rounded-md px-3", - lg: "h-11 rounded-md px-8", - icon: "h-10 w-10", - }, - }, -}) -``` - -### Sheet - -1. Replace the content of `sheet.tsx` with the following: - -```tsx title="components/ui/sheet.tsx" showLineNumbers -"use client" - -import * as React from "react" -import * as SheetPrimitive from "@radix-ui/react-dialog" -import { cva, type VariantProps } from "class-variance-authority" -import { X } from "lucide-react" - -import { cn } from "@/lib/utils" - -const Sheet = SheetPrimitive.Root - -const SheetTrigger = SheetPrimitive.Trigger - -const SheetClose = SheetPrimitive.Close - -const SheetPortal = ({ - className, - ...props -}: SheetPrimitive.DialogPortalProps) => ( - -) -SheetPortal.displayName = SheetPrimitive.Portal.displayName - -const SheetOverlay = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -SheetOverlay.displayName = SheetPrimitive.Overlay.displayName - -const sheetVariants = cva( - "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500", - { - variants: { - side: { - top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", - bottom: - "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom", - left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", - right: - "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm", - }, - }, - defaultVariants: { - side: "right", - }, - } -) - -interface SheetContentProps - extends React.ComponentPropsWithoutRef, - VariantProps {} - -const SheetContent = React.forwardRef< - React.ElementRef, - SheetContentProps ->(({ side = "right", className, children, ...props }, ref) => ( - - - - {children} - - - Close - - - -)) -SheetContent.displayName = SheetPrimitive.Content.displayName - -const SheetHeader = ({ - className, - ...props -}: React.HTMLAttributes) => ( -
-) -SheetHeader.displayName = "SheetHeader" - -const SheetFooter = ({ - className, - ...props -}: React.HTMLAttributes) => ( -
-) -SheetFooter.displayName = "SheetFooter" - -const SheetTitle = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -SheetTitle.displayName = SheetPrimitive.Title.displayName - -const SheetDescription = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -SheetDescription.displayName = SheetPrimitive.Description.displayName - -export { - Sheet, - SheetTrigger, - SheetClose, - SheetContent, - SheetHeader, - SheetFooter, - SheetTitle, - SheetDescription, -} -``` - -2. Rename `position` to `side` - -```diff /position/ /side/ -- -+ -``` - - - -### Thank you - -I'd like to thank everyone who has been using this project, providing feedback and contributing to it. I really appreciate it. Thank you 🙏 diff --git a/apps/v4/content/docs/(root)/meta.json b/apps/v4/content/docs/(root)/meta.json index 05b99172bf..5c2f3e1a78 100644 --- a/apps/v4/content/docs/(root)/meta.json +++ b/apps/v4/content/docs/(root)/meta.json @@ -13,7 +13,7 @@ "javascript", "blocks", "figma", - "changelog", + "[Changelog](/docs/changelog)", "[llms.txt](/llms.txt)", "legacy" ] diff --git a/apps/v4/content/docs/changelog/2023-06-new-cli.mdx b/apps/v4/content/docs/changelog/2023-06-new-cli.mdx new file mode 100644 index 0000000000..0f9f560080 --- /dev/null +++ b/apps/v4/content/docs/changelog/2023-06-new-cli.mdx @@ -0,0 +1,478 @@ +--- +title: June 2023 - New CLI, Styles and more +description: Complete CLI rewrite with new styles, theming options, and more. +date: 2023-06-22 +--- + +I have a lot of updates to share with you today: + +- [**New CLI**](#new-cli) - Rewrote the CLI from scratch. You can now add components, dependencies and configure import paths. +- [**Theming**](#theming-with-css-variables-or-tailwind-colors) - Choose between using CSS variables or Tailwind CSS utility classes for theming. +- [**Base color**](#base-color) - Configure the base color for your project. This will be used to generate the default color palette for your components. +- [**React Server Components**](#react-server-components) - Opt out of using React Server Components. The CLI will automatically append or remove the `use client` directive. +- [**Styles**](#styles) - Introducing a new concept called _Style_. A style comes with its own set of components, animations, icons and more. +- [**Exit animations**](#exit-animations) - Added exit animations to all components. +- [**Other updates**](#other-updates) - New `icon` button size, updated `sheet` component and more. +- [**Updating your project**](#updating-your-project) - How to update your project to get the latest changes. + +--- + +### New CLI + +I've been working on a new CLI for the past few weeks. It's a complete rewrite. It comes with a lot of new features and improvements. + +### `init` + +```bash +npx shadcn@latest init +``` + +When you run the `init` command, you will be asked a few questions to configure `components.json`: + +```txt showLineNumbers +Which style would you like to use? › Default +Which color would you like to use as base color? › Slate +Where is your global CSS file? › › app/globals.css +Do you want to use CSS variables for colors? › no / yes +Where is your tailwind.config.js located? › tailwind.config.js +Configure the import alias for components: › @/components +Configure the import alias for utils: › @/lib/utils +Are you using React Server Components? › no / yes +``` + +This file contains all the information about your components: where to install them, the import paths, how they are styled...etc. + +You can use this file to change the import path of a component, set a baseColor or change the styling method. + +```json title="components.json" showLineNumbers +{ + "style": "default", + "tailwind": { + "config": "tailwind.config.ts", + "css": "src/app/globals.css", + "baseColor": "zinc", + "cssVariables": true + }, + "rsc": false, + "aliases": { + "utils": "~/lib/utils", + "components": "~/components" + } +} +``` + +This means you can now use the CLI with any directory structure including `src` and `app` directories. + +### `add` + +```bash +npx shadcn@latest add +``` + +The `add` command is now much more capable. You can now add UI components but also import more complex components (coming soon). + +The CLI will automatically resolve all components and dependencies, format them based on your custom config and add them to your project. + +### `diff` (experimental) + +```bash +npx shadcn diff +``` + +We're also introducing a new `diff` command to help you keep track of upstream updates. + +You can use this command to see what has changed in the upstream repository and update your project accordingly. + +Run the `diff` command to get a list of components that have updates available: + +```bash +npx shadcn diff +``` + +```txt +The following components have updates available: +- button + - /path/to/my-app/components/ui/button.tsx +- toast + - /path/to/my-app/components/ui/use-toast.ts + - /path/to/my-app/components/ui/toaster.tsx +``` + +Then run `diff [component]` to see the changes: + +```bash +npx shadcn diff alert +``` + +```diff /pl-12/ +const alertVariants = cva( +- "relative w-full rounded-lg border", ++ "relative w-full pl-12 rounded-lg border" +) +``` + +--- + +### Theming with CSS Variables or Tailwind Colors + +You can choose between using CSS variables or Tailwind CSS utility classes for theming. + +When you add new components, the CLI will automatically use the correct theming methods based on your `components.json` configuration. + +#### Utility classes + +```tsx /bg-zinc-950/ /text-zinc-50/ /dark:bg-white/ /dark:text-zinc-950/ +
+``` + +To use utility classes for theming set `tailwind.cssVariables` to `false` in your `components.json` file. + +```json {6} title="components.json" showLineNumbers +{ + "tailwind": { + "config": "tailwind.config.js", + "css": "app/globals.css", + "baseColor": "slate", + "cssVariables": false + } +} +``` + +#### CSS Variables + +```tsx /bg-background/ /text-foreground/ +
+``` + +To use CSS variables classes for theming set `tailwind.cssVariables` to `true` in your `components.json` file. + +```json {6} title="components.json" showLineNumbers +{ + "tailwind": { + "config": "tailwind.config.js", + "css": "app/globals.css", + "baseColor": "slate", + "cssVariables": true + } +} +``` + +--- + +### Base color + +You can now configure the base color for your project. This will be used to generate the default color palette for your components. + +```json {5} title="components.json" showLineNumbers +{ + "tailwind": { + "config": "tailwind.config.js", + "css": "app/globals.css", + "baseColor": "zinc", + "cssVariables": false + } +} +``` + +Choose between `gray`, `neutral`, `slate`, `stone` or `zinc`. + +If you have `cssVariables` set to `true`, we will set the base colors as CSS variables in your `globals.css` file. If you have `cssVariables` set to `false`, we will inline the Tailwind CSS utility classes in your components. + +--- + +### React Server Components + +If you're using a framework that does not support React Server Components, you can now opt out by setting `rsc` to `false`. We will automatically append or remove the `use client` directive when adding components. + +```json title="components.json" showLineNumbers +{ + "rsc": false +} +``` + +--- + +### Styles + +We are introducing a new concept called _Style_. + +_You can think of style as the visual foundation: shapes, icons, animations & typography._ A style comes with its own set of components, animations, icons and more. + +We are shipping two styles: `default` and `new-york` (with more coming soon). + +Default vs New York style + +The `default` style is the one you are used to. It's the one we've been using since the beginning of this project. It uses `lucide-react` for icons and `tailwindcss-animate` for animations. + +The `new-york` style is a new style. It ships with smaller buttons, cards with shadows and a new set of icons from [Radix Icons](https://icons.radix-ui.com). + +When you run the `init` command, you will be asked which style you would like to use. This is saved in your `components.json` file. + +```json title="components.json" showLineNumbers +{ + "style": "new-york" +} +``` + +### Theming + +Start with a style as the base then theme using CSS variables or Tailwind CSS utility classes to completely change the look of your components. + +Style with theming + +--- + +### Exit animations + +I added exit animations to all components. Click on the combobox below to see the subtle exit animation. + + + +The animations can be customized using utility classes. + +--- + +### Other updates + +### Button + +- Added a new button size `icon`: + + + +### Sheet + +- Renamed `position` to `side` to match the other elements. + + + +- Removed the `size` props. Use `className="w-[200px] md:w-[450px]"` for responsive sizing. + +--- + +### Updating your project + +Since we follow a copy and paste approach, you will need to manually update your project to get the latest changes. + + + Note: we are working on a [`diff`](#diff-experimental) command to help you + keep track of upstream updates. + + + + +### Add `components.json` + +Creating a `components.json` file at the root: + +```json title="components.json" showLineNumbers +{ + "style": "default", + "rsc": true, + "tailwind": { + "config": "tailwind.config.js", + "css": "app/globals.css", + "baseColor": "slate", + "cssVariables": true + }, + "aliases": { + "components": "@/components", + "utils": "@/lib/utils" + } +} +``` + +Update the values for `tailwind.css` and `aliases` to match your project structure. + +### Button + +Add the `icon` size to the `buttonVariants`: + +```tsx {7} title="components/ui/button.tsx" showLineNumbers +const buttonVariants = cva({ + variants: { + size: { + default: "h-10 px-4 py-2", + sm: "h-9 rounded-md px-3", + lg: "h-11 rounded-md px-8", + icon: "h-10 w-10", + }, + }, +}) +``` + +### Sheet + +1. Replace the content of `sheet.tsx` with the following: + +```tsx title="components/ui/sheet.tsx" showLineNumbers +"use client" + +import * as React from "react" +import * as SheetPrimitive from "@radix-ui/react-dialog" +import { cva, type VariantProps } from "class-variance-authority" +import { X } from "lucide-react" + +import { cn } from "@/lib/utils" + +const Sheet = SheetPrimitive.Root + +const SheetTrigger = SheetPrimitive.Trigger + +const SheetClose = SheetPrimitive.Close + +const SheetPortal = ({ + className, + ...props +}: SheetPrimitive.DialogPortalProps) => ( + +) +SheetPortal.displayName = SheetPrimitive.Portal.displayName + +const SheetOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +SheetOverlay.displayName = SheetPrimitive.Overlay.displayName + +const sheetVariants = cva( + "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500", + { + variants: { + side: { + top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", + bottom: + "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom", + left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", + right: + "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm", + }, + }, + defaultVariants: { + side: "right", + }, + } +) + +interface SheetContentProps + extends React.ComponentPropsWithoutRef, + VariantProps {} + +const SheetContent = React.forwardRef< + React.ElementRef, + SheetContentProps +>(({ side = "right", className, children, ...props }, ref) => ( + + + + {children} + + + Close + + + +)) +SheetContent.displayName = SheetPrimitive.Content.displayName + +const SheetHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +SheetHeader.displayName = "SheetHeader" + +const SheetFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +SheetFooter.displayName = "SheetFooter" + +const SheetTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +SheetTitle.displayName = SheetPrimitive.Title.displayName + +const SheetDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +SheetDescription.displayName = SheetPrimitive.Description.displayName + +export { + Sheet, + SheetTrigger, + SheetClose, + SheetContent, + SheetHeader, + SheetFooter, + SheetTitle, + SheetDescription, +} +``` + +2. Rename `position` to `side` + +```diff /position/ /side/ +- ++ +``` + + + +### Thank you + +I'd like to thank everyone who has been using this project, providing feedback and contributing to it. I really appreciate it. Thank you. diff --git a/apps/v4/content/docs/changelog/2023-07-javascript.mdx b/apps/v4/content/docs/changelog/2023-07-javascript.mdx new file mode 100644 index 0000000000..d8a91dda51 --- /dev/null +++ b/apps/v4/content/docs/changelog/2023-07-javascript.mdx @@ -0,0 +1,45 @@ +--- +title: July 2023 - JavaScript +description: JavaScript version of components available via the CLI. +date: 2023-07-04 +--- + +This project and the components are written in TypeScript. **We recommend using TypeScript for your project as well**. + +However we provide a JavaScript version of the components, available via the [cli](/docs/cli). + +```txt +Would you like to use TypeScript (recommended)? no +``` + +To opt-out of TypeScript, you can use the `tsx` flag in your `components.json` file. + +```json {10} title="components.json" showLineNumbers +{ + "style": "default", + "tailwind": { + "config": "tailwind.config.js", + "css": "src/app/globals.css", + "baseColor": "zinc", + "cssVariables": true + }, + "rsc": false, + "tsx": false, + "aliases": { + "utils": "~/lib/utils", + "components": "~/components" + } +} +``` + +To configure import aliases, you can use the following `jsconfig.json`: + +```json {4} title="jsconfig.json" showLineNumbers +{ + "compilerOptions": { + "paths": { + "@/*": ["./*"] + } + } +} +``` diff --git a/apps/v4/content/docs/changelog/2023-12-new-components.mdx b/apps/v4/content/docs/changelog/2023-12-new-components.mdx new file mode 100644 index 0000000000..e4133f71f8 --- /dev/null +++ b/apps/v4/content/docs/changelog/2023-12-new-components.mdx @@ -0,0 +1,68 @@ +--- +title: December 2023 - New Components +description: Carousel, Drawer, Pagination, Resizable, Sonner, and CLI updates. +date: 2023-12-22 +--- + +We've added new components to shadcn/ui and made a lot of improvements to the CLI. + +Here's a quick overview of what's new: + +- [**Carousel**](#carousel) - A carousel component with motion, swipe gestures and keyboard support. +- [**Drawer**](#drawer) - A drawer component that looks amazing on mobile. +- [**Pagination**](#pagination) - A pagination component with page navigation, previous and next buttons. +- [**Resizable**](#resizable) - A resizable component for building resizable panel groups and layouts. +- [**Sonner**](#sonner) - The last toast component you'll ever need. +- [**CLI updates**](#cli-updates) - Support for custom **Tailwind prefix** and `tailwind.config.ts`. + +### Carousel + +We've added a fully featured carousel component with motion, swipe gestures and keyboard support. Built on top of [Embla Carousel](https://www.embla-carousel.com). + +It has support for infinite looping, autoplay, vertical orientation, and more. + + + +### Drawer + +Oh the drawer component. Built on top of [Vaul](https://github.com/emilkowalski/vaul) by [emilkowalski](https://twitter.com/emilkowalski). + +Try opening the following drawer on mobile. It looks amazing! + + + +### Pagination + +We've added a pagination component with page navigation, previous and next buttons. Simple, flexible and works with your framework's `` component. + + + +### Resizable + +Build resizable panel groups and layouts with this `` component. + + + +`` is built using [react-resizable-panels](https://github.com/bvaughn/react-resizable-panels) by [bvaughn](https://github.com/bvaughn). It has support for mouse, touch and keyboard. + +### Sonner + +Another one by [emilkowalski](https://twitter.com/emilkowalski). The last toast component you'll ever need. Sonner is now availabe in shadcn/ui. + + + +### CLI updates + +This has been one of the most requested features. You can now configure a custom Tailwind prefix and the cli will automatically prefix your utility classes when adding components. + +This means you can now easily add shadcn/ui components to existing projects like Docusaurus, Nextra...etc. A drop-in for your existing design system with no conflict. + +```tsx /tw-/ + +``` + +It works with `cn`, `cva` and CSS variables. + +The cli can now also detect `tailwind.config.ts` and add the TypeScript version of the config for you. + +That's it. Happy Holidays. diff --git a/apps/v4/content/docs/changelog/2024-03-blocks.mdx b/apps/v4/content/docs/changelog/2024-03-blocks.mdx new file mode 100644 index 0000000000..79052f3c8d --- /dev/null +++ b/apps/v4/content/docs/changelog/2024-03-blocks.mdx @@ -0,0 +1,99 @@ +--- +title: March 2024 - Introducing Blocks +description: Ready-made components for dashboards and authentication pages. +date: 2024-03-22 +--- + +One of the most requested features since launch has been layouts: admin dashboards with sidebar, marketing page sections, cards and more. + +**Today, we're launching [**Blocks**](/blocks)**. + + + Admin dashboard + Admin dashboard + View the blocks library + + +Blocks are ready-made components that you can use to build your apps. They are fully responsive, accessible, and composable, meaning they are built using the same principles as the rest of the components in shadcn/ui. + +We're starting with dashboard layouts and authentication pages, with plans to add more blocks in the coming weeks. + +### Open Source + +Blocks are open source. You can find the source on GitHub. Use them in your projects, customize them and contribute back. + + + AI Playground + AI Playground + View the blocks library + + +### Request a Block + +We're also introducing a "Request a Block" feature. If there's a specific block you'd like to see, simply create a request on GitHub and the community can upvote and build it. + + + Settings Page + Settings Page + View the blocks library + + +### v0 + +If you have a [v0](https://v0.dev) account, you can use the **Edit in v0** feature to open the code on v0 for prompting and further generation. + +
+ + + + +
+ +That's it. _Looking forward to seeing what you build with Blocks_. diff --git a/apps/v4/content/docs/changelog/2024-03-breadcrumb-otp.mdx b/apps/v4/content/docs/changelog/2024-03-breadcrumb-otp.mdx new file mode 100644 index 0000000000..e6ef059959 --- /dev/null +++ b/apps/v4/content/docs/changelog/2024-03-breadcrumb-otp.mdx @@ -0,0 +1,25 @@ +--- +title: March 2024 - Breadcrumb and Input OTP +description: New Breadcrumb and Input OTP components. +date: 2024-03-08 +--- + +We've added a new Breadcrumb component and an Input OTP component. + +### Breadcrumb + +An accessible and flexible breadcrumb component. It has support for collapsed items, custom separators, bring-your-own routing `` and composable with other shadcn/ui components. + + + +[See more examples](/docs/components/breadcrumb) + +### Input OTP + +A fully featured input OTP component. It has support for numeric and alphanumeric codes, custom length, copy-paste and accessible. Input OTP is built on top of [input-otp](https://github.com/guilhermerodz/input-otp) by [@guilherme_rodz](https://twitter.com/guilherme_rodz). + + + +[Read the docs](/docs/components/input-otp) + +If you have a [v0](https://v0.dev), the new components are available for generation. diff --git a/apps/v4/content/docs/changelog/2024-04-lift-mode.mdx b/apps/v4/content/docs/changelog/2024-04-lift-mode.mdx new file mode 100644 index 0000000000..d70cb2bfe1 --- /dev/null +++ b/apps/v4/content/docs/changelog/2024-04-lift-mode.mdx @@ -0,0 +1,31 @@ +--- +title: April 2024 - Lift Mode +description: A new mode for Blocks to lift smaller components for copy and paste. +date: 2024-04-05 +--- + +We're introducing a new mode for [Blocks](/blocks) called **Lift Mode**. + +Enable Lift Mode to automatically "lift" smaller components from a block template for copy and paste. + + + Lift Mode + Lift Mode + View the blocks library + + +With Lift Mode, you'll be able to copy the smaller components that make up a block template, like cards, buttons, and forms, and paste them directly into your project. + +Visit the [Blocks](/blocks) page to try it out. diff --git a/apps/v4/content/docs/changelog/2024-08-npx-shadcn-init.mdx b/apps/v4/content/docs/changelog/2024-08-npx-shadcn-init.mdx new file mode 100644 index 0000000000..b185f34a0c --- /dev/null +++ b/apps/v4/content/docs/changelog/2024-08-npx-shadcn-init.mdx @@ -0,0 +1,45 @@ +--- +title: August 2024 - npx shadcn init +description: Complete CLI rewrite with support for all major React frameworks. +date: 2024-08-31 +--- + +The new CLI is now available. It's a complete rewrite with a lot of new features and improvements. You can now install components, themes, hooks, utils and more using `npx shadcn add`. + +This is a major step towards distributing code that you and your LLMs can access and use. + +1. First up, the cli now has support for all major React framework out of the box. Next.js, Remix, Vite and Laravel. And when you init into a new app, we update your existing Tailwind files instead of overriding. +2. A component now ship its own dependencies. Take the accordion for example, it can define its Tailwind keyframes. When you add it to your project, we'll update your tailwind.config.ts file accordingly. +3. You can also install remote components using url. `npx shadcn add https://acme.com/registry/navbar.json`. +4. We have also improve the init command. It does framework detection and can even init a brand new Next.js app in one command. `npx shadcn init`. +5. We have created a new schema that you can use to ship your own component registry. And since it has support for urls, you can even use it to distribute private components. +6. And a few more updates like better error handling and monorepo support. + +You can try the new cli today. + +```bash +npx shadcn init sidebar-01 login-01 +``` + +### Update Your Project + +To update an existing project to use the new CLI, update your `components.json` file to include import aliases for your **components**, **utils**, **ui**, **lib** and **hooks**. + +```json showLineNumbers {7-13} title="components.json" +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "new-york", + "tailwind": { + // ... + }, + "aliases": { + "components": "@/components", + "utils": "@/lib/utils", + "ui": "@/components/ui", + "lib": "@/lib", + "hooks": "@/hooks" + } +} +``` + +If you're using a different import alias prefix eg `~`, replace `@` with your prefix. diff --git a/apps/v4/content/docs/changelog/2024-10-react-19.mdx b/apps/v4/content/docs/changelog/2024-10-react-19.mdx new file mode 100644 index 0000000000..112e57ac0e --- /dev/null +++ b/apps/v4/content/docs/changelog/2024-10-react-19.mdx @@ -0,0 +1,11 @@ +--- +title: October 2024 - React 19 +description: shadcn/ui is now compatible with React 19 and Next.js 15. +date: 2024-10-29 +--- + +shadcn/ui is now compatible with React 19 and Next.js 15. + +We published a guide to help you upgrade your project to React 19. + +Read more [here](/docs/react-19). diff --git a/apps/v4/content/docs/changelog/2024-10-sidebar.mdx b/apps/v4/content/docs/changelog/2024-10-sidebar.mdx new file mode 100644 index 0000000000..e0263dfd6b --- /dev/null +++ b/apps/v4/content/docs/changelog/2024-10-sidebar.mdx @@ -0,0 +1,13 @@ +--- +title: October 2024 - Sidebar +description: 25 components to help you build all kinds of sidebars. +date: 2024-10-18 +--- + +Introducing sidebar.tsx: 25 components to help you build all kinds of sidebars. + +I don't like building sidebars. So I built 30+ of them. All types. Then simplified the core into sidebar.tsx: a strong foundation to build on top of. + +It works with Next.js, Remix, Vite & Laravel. + +See the announcement [here](https://x.com/shadcn/status/1847359896557408461). diff --git a/apps/v4/content/docs/changelog/2024-11-icons.mdx b/apps/v4/content/docs/changelog/2024-11-icons.mdx new file mode 100644 index 0000000000..0fc5233dda --- /dev/null +++ b/apps/v4/content/docs/changelog/2024-11-icons.mdx @@ -0,0 +1,13 @@ +--- +title: November 2024 - Icons +description: The new-york style now uses Lucide as the default icon set. +date: 2024-11-06 +--- + +An update on icons. The new-york style now uses Lucide as the default icon set. + +- New projects will use Lucide by default +- No breaking changes for existing projects +- Use the CLI to (optionally) migrate primitives to Lucide + +For more info on why we're doing this, see the [thread](https://x.com/shadcn/status/1853902179041702169). diff --git a/apps/v4/content/docs/changelog/2024-12-monorepo.mdx b/apps/v4/content/docs/changelog/2024-12-monorepo.mdx new file mode 100644 index 0000000000..9158238623 --- /dev/null +++ b/apps/v4/content/docs/changelog/2024-12-monorepo.mdx @@ -0,0 +1,18 @@ +--- +title: December 2024 - Monorepo Support +description: New monorepo support in the CLI. +date: 2024-12-20 +--- + +Until now, using shadcn/ui in a monorepo was a bit of a pain. You could add +components using the CLI, but you had to manage where the components +were installed and manually fix import paths. + +With the new monorepo support in the CLI, we've made it a lot easier to use +shadcn/ui in a monorepo. + +The CLI now understands the monorepo structure and will install the components, +dependencies and registry dependencies to the correct paths and handle imports +for you. + +Read more in the [docs](/docs/monorepo). diff --git a/apps/v4/content/docs/changelog/2025-01-blocks.mdx b/apps/v4/content/docs/changelog/2025-01-blocks.mdx new file mode 100644 index 0000000000..68c8fe1831 --- /dev/null +++ b/apps/v4/content/docs/changelog/2025-01-blocks.mdx @@ -0,0 +1,11 @@ +--- +title: January 2025 - Blocks Community +description: Inviting the community to contribute to the blocks library. +date: 2025-01-14 +--- + +We are inviting the community to contribute to the blocks library. Share your components and blocks with other developers and help build a library of high-quality, reusable components. + +We'd love to see all types of blocks: applications, marketing, products, and more. + +See the [docs](/docs/blocks) page to get started. diff --git a/apps/v4/content/docs/changelog/2025-02-registry-schema.mdx b/apps/v4/content/docs/changelog/2025-02-registry-schema.mdx new file mode 100644 index 0000000000..5aa8cf6726 --- /dev/null +++ b/apps/v4/content/docs/changelog/2025-02-registry-schema.mdx @@ -0,0 +1,13 @@ +--- +title: February 2025 - Updated Registry Schema +description: Updated registry schema to support more features. +date: 2025-02-06 +--- + +We're updating the registry schema to support more features. + +Define code as a flat JSON file and distribute it via the CLI. + +- Custom styles: bring your own design system, components & tokens +- Extend, override, mix & match components from third-party registries and LLMs +- Install themes, CSS vars, hooks, animations, and Tailwind layers & utilities diff --git a/apps/v4/content/docs/changelog/2025-02-tailwind-v4.mdx b/apps/v4/content/docs/changelog/2025-02-tailwind-v4.mdx new file mode 100644 index 0000000000..f36d734c27 --- /dev/null +++ b/apps/v4/content/docs/changelog/2025-02-tailwind-v4.mdx @@ -0,0 +1,22 @@ +--- +title: February 2025 - Tailwind v4 +description: First preview of Tailwind v4 and React 19 support. +date: 2025-02-19 +--- + +We shipped the first preview of Tailwind v4 and React 19. Ready for you to try out. You can start using it today. + +What's New: + +- The CLI can now initialize projects with Tailwind v4. +- Full support for the new @theme directive and @theme inline option. +- All components are updated for Tailwind v4 and React 19. +- We've removed the forwardRefs and adjusted the types. +- Every primitive now has a data-slot attribute for styling. +- We've fixed and cleaned up the style of the components. +- We're deprecating the toast component in favor of sonner. +- Buttons now use the default cursor. +- We're deprecating the default style. New projects will use new-york. +- HSL colors are now converted to OKLCH. + +Read more in the [docs](/docs/tailwind-v4). diff --git a/apps/v4/content/docs/changelog/2025-04-cross-framework.mdx b/apps/v4/content/docs/changelog/2025-04-cross-framework.mdx new file mode 100644 index 0000000000..8f6b6c82d2 --- /dev/null +++ b/apps/v4/content/docs/changelog/2025-04-cross-framework.mdx @@ -0,0 +1,9 @@ +--- +title: March 2025 - Cross-framework Route Support +description: The shadcn CLI can now auto-detect your framework and adapts routes for you. +date: 2025-04-09 +--- + +The shadcn CLI can now auto-detect your framework and adapts routes for you. + +Works with all frameworks including Laravel, Vite and React Router. diff --git a/apps/v4/content/docs/changelog/2025-04-mcp.mdx b/apps/v4/content/docs/changelog/2025-04-mcp.mdx new file mode 100644 index 0000000000..63881386e6 --- /dev/null +++ b/apps/v4/content/docs/changelog/2025-04-mcp.mdx @@ -0,0 +1,17 @@ +--- +title: April 2025 - MCP +description: Zero-config MCP support for shadcn/ui registry. +date: 2025-04-30 +--- + +We're working on zero-config MCP support for shadcn/ui registry. One command `npx shadcn registry:mcp` to make any registry mcp-compatible. + +Lift Mode + +Learn more in the [thread here](https://x.com/shadcn/status/1917597228513853603). diff --git a/apps/v4/content/docs/changelog/2025-04-shadcn-2-5.mdx b/apps/v4/content/docs/changelog/2025-04-shadcn-2-5.mdx new file mode 100644 index 0000000000..86af7f5fdb --- /dev/null +++ b/apps/v4/content/docs/changelog/2025-04-shadcn-2-5.mdx @@ -0,0 +1,11 @@ +--- +title: March 2025 - shadcn 2.5.0 +description: Resolve anywhere - registries can now place files anywhere in an app. +date: 2025-04-26 +--- + +We tagged shadcn 2.5.0 earlier this week. It comes with a pretty cool feature: **resolve anywhere**. + +Registries can now place files anywhere in an app and we'll properly resolve imports. No need to stick to a fixed file structure. It can even add files outside the registry itself. + +On install, we track all files and perform a multi-pass resolution to correctly handle imports and aliases. It's fast. diff --git a/apps/v4/content/docs/changelog/2025-05-new-site.mdx b/apps/v4/content/docs/changelog/2025-05-new-site.mdx new file mode 100644 index 0000000000..eff3fda949 --- /dev/null +++ b/apps/v4/content/docs/changelog/2025-05-new-site.mdx @@ -0,0 +1,11 @@ +--- +title: May 2025 - New Site +description: Upgraded ui.shadcn.com to Next.js 15.3 and Tailwind v4. +date: 2025-05-30 +--- + +We've upgraded [ui.shadcn.com](https://ui.shadcn.com) to Next.js 15.3 and Tailwind v4. The site now uses the upgraded `new-york` components. + +We've also made some minor design updates to make the site faster and easier to navigate. + +This upgrade unlocks a lot of new features that we're working on. More to come. diff --git a/apps/v4/content/docs/changelog/2025-06-calendar.mdx b/apps/v4/content/docs/changelog/2025-06-calendar.mdx new file mode 100644 index 0000000000..08791ee63a --- /dev/null +++ b/apps/v4/content/docs/changelog/2025-06-calendar.mdx @@ -0,0 +1,15 @@ +--- +title: June 2025 - Calendar Component +description: Upgraded Calendar component with React DayPicker and 30+ calendar blocks. +date: 2025-06-06 +--- + +We've upgraded the `Calendar` component to the latest version of [React DayPicker](https://daypicker.dev). + +This is a major upgrade and includes a lot of new features and improvements. We've also built a collection of 30+ calendar blocks that you can use to build your own calendar components. + +See all calendar blocks in the [Blocks Library](/blocks/calendar) page. + +Calendar + +To upgrade your project to the latest version of the `Calendar` component, see the [upgrade guide](/docs/components/calendar#upgrade-guide). diff --git a/apps/v4/content/docs/changelog/2025-06-radix-ui.mdx b/apps/v4/content/docs/changelog/2025-06-radix-ui.mdx new file mode 100644 index 0000000000..235b371eb4 --- /dev/null +++ b/apps/v4/content/docs/changelog/2025-06-radix-ui.mdx @@ -0,0 +1,22 @@ +--- +title: June 2025 - radix-ui Migration +description: A new command to migrate to the new radix-ui package. +date: 2025-06-11 +--- + +We've added a new command to migrate to the new `radix-ui` package. This command will replace all `@radix-ui/react-*` imports with `radix-ui`. + +```bash +npx shadcn@latest migrate radix +``` + +It will automatically update all imports in your `ui` components and install `radix-ui` as a dependency. + +```diff showLineNumbers title="components/ui/alert-dialog.tsx" +- import * as AlertDialogPrimitive from "@radix-ui/react-dialog" ++ import { AlertDialog as AlertDialogPrimitive } from "radix-ui" +``` + +Make sure to test your components and project after running the command. + +**Note:** To update imports for newly added components, run the migration command again. diff --git a/apps/v4/content/docs/changelog/2025-07-local-file-support.mdx b/apps/v4/content/docs/changelog/2025-07-local-file-support.mdx new file mode 100644 index 0000000000..4481f9ca51 --- /dev/null +++ b/apps/v4/content/docs/changelog/2025-07-local-file-support.mdx @@ -0,0 +1,22 @@ +--- +title: July 2025 - Local File Support +description: Initialize projects and add components from local JSON files. +date: 2025-07-07 +--- + +The shadcn CLI now supports local files. Initialize projects and add components, themes, hooks, utils and more from local JSON files. + +```bash +# Initialize a project from a local file +npx shadcn init ./template.json + +# Add a component from a local file +npx shadcn add ./block.json +``` + +This feature enables powerful new workflows: + +- **Zero setup** - No remote registries required +- **Faster development** - Test registry items locally before publishing +- **Enhanced workflow for agents and MCP** - Generate and run registry items locally +- **Private components** - Keep proprietary components local and private. diff --git a/apps/v4/content/docs/changelog/2025-07-universal-registry.mdx b/apps/v4/content/docs/changelog/2025-07-universal-registry.mdx new file mode 100644 index 0000000000..1e9052208e --- /dev/null +++ b/apps/v4/content/docs/changelog/2025-07-universal-registry.mdx @@ -0,0 +1,11 @@ +--- +title: July 2025 - Universal Registry Items +description: Create registry items that can be distributed to any project. +date: 2025-07-11 +--- + +We've added support for universal registry items. This allows you to create registry items that can be distributed to any project i.e. no framework, no components.json, no tailwind, no react required. + +This new registry item type unlocks a lot of new workflows. You can now distribute code, config, rules, docs, anything to any code project. + +See the [docs](/docs/registry/examples) for more details and examples. diff --git a/apps/v4/content/docs/changelog/2025-08-cli-3-mcp.mdx b/apps/v4/content/docs/changelog/2025-08-cli-3-mcp.mdx new file mode 100644 index 0000000000..f559654668 --- /dev/null +++ b/apps/v4/content/docs/changelog/2025-08-cli-3-mcp.mdx @@ -0,0 +1,206 @@ +--- +title: August 2025 - shadcn CLI 3.0 and MCP Server +description: Namespaced registries, advanced authentication, new commands and a completely rewritten registry engine. +date: 2025-08-27 +--- + +We just shipped shadcn CLI 3.0 with support for namespaced registries, advanced authentication, new commands and a completely rewritten registry engine. + +### What's New + +- [Namespaced Registries](#namespaced-registries) - Install components using `@registry/name` format. +- [Private Registries](#private-registries) - Secure your registry with advanced authentication. +- [Search & Discovery](#search--discovery) - New commands to find and view code before installing. +- [MCP Server](#mcp-server) - MCP server for all registries. +- [Faster Everything](#faster-everything) - Completely rewritten registry resolution. +- [Improved Error Handling](#improved-error-handling) - Better error messages for users and LLMs. +- [Upgrade Guide](#upgrade-guide) - Migration notes for existing users. + +### Namespaced Registries + +The biggest change in 3.0 is namespaced registries. You can now install components from registries: a community registry, your company's private registry or internal registry, using the `@registry/name` format. + +This makes it easier to distribute code across teams and projects. + +Configure registries in your `components.json`: + +```json title="components.json" +{ + "registries": { + "@acme": "https://acme.com/r/{name}.json", + "@internal": { + "url": "https://registry.company.com/{name}", + "headers": { + "Authorization": "Bearer ${REGISTRY_TOKEN}" + } + } + } +} +``` + +Then use the `@registry/name` format to install components: + +```bash +npx shadcn add @acme/button @internal/auth-system +``` + +It's completely decentralized. There's no central registrar. Create any namespace you want and organize components however makes sense for your team. + +```json title="components.json" showLineNumbers +{ + "registries": { + "@design": "https://registry.company.com/create/{name}.json", + "@engineering": "https://registry.company.com/eng/{name}.json", + "@marketing": "https://registry.company.com/marketing/{name}.json" + } +} +``` + +Components can even depend on resources from different registries. Everything gets resolved and installed automatically from the right sources. + +```json title="registry-item.json" showLineNumbers +{ + "name": "dashboard", + "type": "registry:block", + "registryDependencies": [ + "@shadcn/card", // From default registry + "@v0/chart", // From v0 registry + "@acme/data-table", // From acme registry + "@lib/data-fetcher", // Utility library + "@ai/analytics-prompt" // AI prompt resource + ] +} +``` + +### Private Registries + +Need to keep your components private? We've got you covered. Configure authentication with tokens, API keys, or custom headers: + +```json title="components.json" +{ + "registries": { + "@private": { + "url": "https://registry.company.com/{name}.json", + "headers": { + "Authorization": "Bearer ${REGISTRY_TOKEN}" + } + } + } +} +``` + +Your private components stay private. Perfect for enterprise teams with proprietary UI libraries. + +We support all major authentication methods: basic auth, bearer token, api key query params and custom headers. + +See the [authentication docs](/docs/registry/authentication) for more details. + +### Search & Discovery + +Three new commands make it easy to find exactly what you need: + +1. View items from the registry before installing + +```bash +npx shadcn view @acme/auth-system +``` + +2. Search items from registries + +```bash +npx shadcn search @tweakcn -q "dark" +``` + +3. List all items from a registry + +```bash +npx shadcn list @acme +``` + +Preview components before installing them. Search across multiple registries. See the code and all dependencies upfront. + +### MCP Server + +Lift Mode + +Back in April, we [introduced](https://x.com/shadcn/status/1917597228513853603) the first version of the MCP server. Since then, we've taken everything we learned and built a better MCP server. + +Here's what's new: + +- Works with all registries. Zero config +- One command to add to your favorite MCP clients +- We improved the underlying tools +- Better integration with the CLI and registries +- Support for multiple registries in the same project + +Add the MCP server to your project: + +```bash +npx shadcn@latest mcp init +``` + +See the [docs](/docs/mcp) for more details. + +### Faster Everything + +We completely rewrote the registry resolution engine from scratch. It's faster, smarter, and handles even the trickiest dependency trees. + +- Up to 3x faster dependency resolution +- Smarter file deduplication and merging +- Better monorepo support out of the box +- Updated `build` command for registry authors + +### Improved Error Handling + +Registry developers can now provide custom error messages to help guide users (and LLMs) when things go wrong. The CLI displays helpful, actionable errors for common issues: + +```txt +Unknown registry "@acme". Make sure it is defined in components.json as follows: +{ + "registries": { + "@acme": "[URL_TO_REGISTRY]" + } +} +``` + +Missing environment variables? The CLI tells you exactly what's needed: + +```txt +Registry "@private" requires the following environment variables: + • REGISTRY_TOKEN + +Set the required environment variables to your .env or .env.local file. +``` + +Registry authors can provide custom error messages in their responses to help users and AI agents understand and fix issues quickly. + +```txt +Error: +You are not authorized to access the item at http://example.com/r/component. + +Message: +[Unauthorized] Your API key has expired. Renew it at https://example.com/api/renew-key. +``` + +### Upgrade Guide + +Here's the best part: there are no breaking changes for users. Your existing `components.json` works exactly the same. All your installed components work exactly the same. + +For developers, if you're using the programmatic APIs directly, we've deprecated a few functions in favor of better ones: + +- `fetchRegistry` → `getRegistry` +- `resolveRegistryTree` → `resolveRegistryItems` +- Schema moved from `shadcn/registry` to `shadcn/schema` package + +```diff +- import { registryItemSchema } from "shadcn/registry" ++ import { registryItemSchema } from "shadcn/schema" +``` + +That's it. Seriously. Everything else just works. diff --git a/apps/v4/content/docs/changelog/2025-09-registry-index.mdx b/apps/v4/content/docs/changelog/2025-09-registry-index.mdx new file mode 100644 index 0000000000..32885f8cd3 --- /dev/null +++ b/apps/v4/content/docs/changelog/2025-09-registry-index.mdx @@ -0,0 +1,19 @@ +--- +title: September 2025 - Registry Index +description: An index of open source registries that you can install items from. +date: 2025-09-02 +--- + +We've created an index of open source registries that you can install items from. + +You can search, view and add items from the registry index without configuring the `.components.json` file. + +They'll be automatically added to your `components.json` file for you. + +```bash +npx shadcn add @ai-elements/prompt-input +``` + +The full list of registries is available at [https://ui.shadcn.com/r/registries.json](https://ui.shadcn.com/r/registries.json). + +To add a registry to the index, submit a PR to the `shadcn/ui` repository. See the [registry index documentation](/docs/registry/registry-index) for more details. diff --git a/apps/v4/content/docs/changelog/2025-10-new-components.mdx b/apps/v4/content/docs/changelog/2025-10-new-components.mdx new file mode 100644 index 0000000000..643fd262f6 --- /dev/null +++ b/apps/v4/content/docs/changelog/2025-10-new-components.mdx @@ -0,0 +1,399 @@ +--- +title: October 2025 - New Components +description: Spinner, Kbd, Button Group, Input Group, Field, Item, and Empty components. +date: 2025-10-03 +--- + +For this round of components, I looked at what we build every day, the boring stuff we rebuild over and over, and made reusable abstractions you can actually use. + +**These components work with every component library, Radix, Base UI, React Aria, you name it. Copy and paste to your projects.** + +- [Spinner](#spinner): An indicator to show a loading state. +- [Kbd](#kbd): Display a keyboard key or group of keys. +- [Button Group](#button-group): A group of buttons for actions and split buttons. +- [Input Group](#input-group): Input with icons, buttons, labels and more. +- [Field](#field): One component. All your forms. +- [Item](#item): Display lists of items, cards, and more. +- [Empty](#empty): Use this one for empty states. + +### Spinner + +Okay let's start with the easiest ones: **Spinner** and **Kbd**. Pretty basic. We all know what they do. + +Here's how you render a spinner: + +```tsx +import { Spinner } from "@/components/ui/spinner" +``` + +```tsx + +``` + +Here's what it looks like: + + + +Here's what it looks like in a button: + + + +You can edit the code and replace it with your own spinner. + + + +### Kbd + +Kbd is a component that renders a keyboard key. + +```tsx +import { Kbd, KbdGroup } from "@/components/ui/kbd" +``` + +```tsx +Ctrl +``` + +Use `KbdGroup` to group keyboard keys together. + +```tsx showLineNumbers + + Ctrl + B + +``` + + + +You can add it to buttons, tooltips, input groups, and more. + +### Button Group + +I got a lot of requests for this one: Button Group. It's a container that groups related buttons together with consistent styling. Great for action groups, split buttons, and more. + + + +Here's the code: + +```tsx +import { ButtonGroup } from "@/components/ui/button-group" +``` + +```tsx showLineNumbers + + + + +``` + +You can nest button groups to create more complex layouts with spacing. + +```tsx showLineNumbers + + + + + + + + + + +``` + +Use `ButtonGroupSeparator` to create split buttons. Classic dropdown pattern. + + + +You can also use it to add prefix or suffix buttons and text to inputs. + + + +```tsx showLineNumbers + + Prefix + + + +``` + +### Input Group + +Input Group lets you add icons, buttons, and more to your inputs. You know, all those little bits you always need around your inputs. + +```tsx +import { + InputGroup, + InputGroupAddon, + InputGroupInput, +} from "@/components/ui/input-group" +``` + +```tsx showLineNumbers + + + + + + +``` + +Here's a preview with icons: + + + +You can also add buttons to the input group. + + + +Or text, labels, tooltips,... + + + +It also works with textareas so you can build really complex components with lots of knobs and dials or yet another prompt form. + + + +Oh here are some cool ones with spinners: + + + +### Field + +Introducing **Field**, a component for building really complex forms. The abstraction here is beautiful. + +It took me a long time to get it right but I made it work with all your form libraries: Server Actions, React Hook Form, TanStack Form, Bring Your Own Form. + +```tsx +import { + Field, + FieldDescription, + FieldError, + FieldLabel, +} from "@/components/ui/field" +``` + +Here's a basic field with an input: + +```tsx showLineNumbers + + Username + + + Choose a unique username for your account. + + +``` + + + +It works with all form controls. Inputs, textareas, selects, checkboxes, radios, switches, sliders, you name it. Here's a full example: + + + +Here are some checkbox fields: + + + +You can group fields together using `FieldGroup` and `FieldSet`. Perfect for +multi-section forms. + +```tsx showLineNumbers +
+ + + + + +
+``` + + + +Making it responsive is easy. Use `orientation="responsive"` and it switches +between vertical and horizontal layouts based on container width. Done. + + + +Wait here's more. Wrap your fields in `FieldLabel` to create a selectable field group. Really easy. And it looks great. + + + +### Item + +This one is a straightforward flex container that can house nearly any type of content. + +I've built this so many times that I decided to create a component for it. Now I use it all the time. I use it to display lists of items, cards, and more. + +```tsx +import { + Item, + ItemContent, + ItemDescription, + ItemMedia, + ItemTitle, +} from "@/components/ui/item" +``` + +Here's a basic item: + +```tsx showLineNumbers + + + + + + Dashboard + Overview of your account and activity. + + +``` + + + +You can add icons, avatars, or images to the item. + + + + + +And here's what a list of items looks like with `ItemGroup`: + + + +Need it as a link? Use the `asChild` prop: + +```tsx showLineNumbers + + + + + + + Dashboard + Overview of your account and activity. + + + +``` + + + +### Empty + +Okay last one: **Empty**. Use this to display empty states in your app. + +```tsx +import { + Empty, + EmptyContent, + EmptyDescription, + EmptyMedia, + EmptyTitle, +} from "@/components/ui/empty" +``` + +Here's how you use it: + +```tsx showLineNumbers + + + + + No messages + You don't have any messages yet. + + + + +``` + + + +You can use it with avatars: + + + +Or with input groups for things like search results or email subscriptions: + + + +That's it. Seven new components. Works with all your libraries. Ready for your projects. diff --git a/apps/v4/content/docs/changelog/2025-10-registry-directory.mdx b/apps/v4/content/docs/changelog/2025-10-registry-directory.mdx new file mode 100644 index 0000000000..6f08d08545 --- /dev/null +++ b/apps/v4/content/docs/changelog/2025-10-registry-directory.mdx @@ -0,0 +1,11 @@ +--- +title: October 2025 - Registry Directory +description: A list of code registries you can browse and pull code and components from. +date: 2025-10-28 +--- + +We just published the Registry Directory: a list of code registries you can browse and pull code and components from. + +https://ui.shadcn.com/docs/directory + +Built into the CLI. No config required. diff --git a/apps/v4/content/docs/changelog/2025-12-shadcn-create.mdx b/apps/v4/content/docs/changelog/2025-12-shadcn-create.mdx new file mode 100644 index 0000000000..69ddf7eec1 --- /dev/null +++ b/apps/v4/content/docs/changelog/2025-12-shadcn-create.mdx @@ -0,0 +1,46 @@ +--- +title: December 2025 - npx shadcn create +description: Customize everything. Pick your component library, icons, base color, theme, fonts and create your own version of shadcn/ui. +date: 2025-12-12 +--- + +From the very first commit, the goal of shadcn/ui was to make it customizable. + +The idea is to give you solid defaults, spacing, color tokens, animations, accessibility, and then let you take it from there. Tweak the code. Add new components. Change the colors. Build your own version. + +But somewhere along the way, all apps started looking the same. I guess the defaults were a little _too_ good. My bad. + +Today, we're changing that: **npx shadcn create**. + +Customize Everything. Pick your component library, icons, base color, theme, fonts and create your own version of shadcn/ui. + +We're starting with **5 new visual styles,** designed to help your UI actually feel like _your_ UI. + +- **Vega** – The classic shadcn/ui look. +- **Nova** – Reduced padding and margins for compact layouts. +- **Maia** – Soft and rounded, with generous spacing. +- **Lyra** – Boxy and sharp. Pairs well with mono fonts. +- **Mira** – Compact. Made for dense interfaces. + +**This goes beyond theming**. + +Your config doesn't just change colors, it rewrites the component code to match your setup. Fonts, spacing, structure, even the libraries you use, everything adapts to your preferences. + +The new CLI takes care of it all. + +Start with a component library. Choose between Radix or Base UI. + +We rebuilt every component for Base UI, keeping the same abstraction. +They are fully compatible with your existing components, even those pulled from remote registries. + +When you pull down components, we auto-detect your library and apply the right transformations. + +**It's time to build something that doesn't look like everything else.** + +Now available for Next.js, Vite, TanStack Start and v0. + + diff --git a/apps/v4/content/docs/changelog/2026-01-base-ui.mdx b/apps/v4/content/docs/changelog/2026-01-base-ui.mdx new file mode 100644 index 0000000000..2e5401c989 --- /dev/null +++ b/apps/v4/content/docs/changelog/2026-01-base-ui.mdx @@ -0,0 +1,45 @@ +--- +title: January 2026 - Base UI Documentation +description: Full documentation for Base UI components. +date: 2026-01-20 +--- + +We've shipped full documentation for Base UI components. + +
+ + + + +
+ +When we launched `npx shadcn create` in December, we introduced the ability to choose between Radix and Base UI as your component library. Today, we're following up with complete documentation for all Base UI components. + +### What's New + +- **Full Base UI docs** - Every component now has dedicated documentation for Base UI, covering usage, props, and examples. +- **Rebuilt examples** - All component examples have been rebuilt for both Radix and Base UI. Switch between them to see the implementation differences. +- **Side-by-side comparison** - The docs make it easy to compare how components work across both libraries. + +### Same Abstraction, Different Primitives + +The goal remains the same: give you a consistent API regardless of which primitive library you choose. The components look and behave the same way. Only the underlying implementation changes. + +```tsx +// Works the same whether you're using Radix or Base UI. +import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog" +``` + +If you're starting a new project, run `npx shadcn create` and pick your preferred library. The CLI handles the rest. + + diff --git a/apps/v4/content/docs/changelog/index.mdx b/apps/v4/content/docs/changelog/index.mdx new file mode 100644 index 0000000000..9374517c58 --- /dev/null +++ b/apps/v4/content/docs/changelog/index.mdx @@ -0,0 +1,6 @@ +--- +title: Changelog +description: Latest updates and announcements. +--- + +Latest updates and announcements for shadcn/ui. diff --git a/apps/v4/content/docs/changelog/meta.json b/apps/v4/content/docs/changelog/meta.json new file mode 100644 index 0000000000..57395b4c6c --- /dev/null +++ b/apps/v4/content/docs/changelog/meta.json @@ -0,0 +1,4 @@ +{ + "title": "Changelog", + "pages": [] +} diff --git a/apps/v4/lib/changelog.ts b/apps/v4/lib/changelog.ts new file mode 100644 index 0000000000..a26e7eb285 --- /dev/null +++ b/apps/v4/lib/changelog.ts @@ -0,0 +1,50 @@ +import fs from "fs" +import path from "path" +import fm from "front-matter" + +import { source } from "@/lib/source" + +export type ChangelogPageData = { + title: string + description?: string +} + +export type ChangelogPage = ReturnType[number] & { + date: Date | null +} + +// Reads the date from the frontmatter of a changelog file. +export function getDateFromFile(slugs: string[]) { + const filePath = path.join( + process.cwd(), + "content/docs", + ...slugs.slice(0, -1), + `${slugs[slugs.length - 1]}.mdx` + ) + try { + const content = fs.readFileSync(filePath, "utf-8") + const { attributes } = fm<{ date?: string | Date }>(content) + if (attributes.date) { + return new Date(attributes.date) + } + } catch { + // File not found or parse error. + } + return null +} + +// Gets all changelog pages sorted by date descending. +export function getChangelogPages() { + return source + .getPages() + .filter((page) => page.slugs[0] === "changelog" && page.slugs.length > 1) + .map((page) => ({ + ...page, + date: getDateFromFile(page.slugs), + })) + .sort((a, b) => { + const dateA = a.date?.getTime() ?? 0 + const dateB = b.date?.getTime() ?? 0 + return dateB - dateA + }) +}