Compare commits

...

501 Commits

Author SHA1 Message Date
shadcn
9f4d65fc8f (9/n) shadcn: add warning for deprecated components (#6576)
* feat(shadcn): add deprecated components warning

* chore: changeset
2025-02-05 22:51:31 +04:00
shadcn
1e357cb20d (8/n) shadcn: default to new-york for v4 (#6574)
* feat(shadcn): handle radius for v4

* feat(shadcn): default to new-york for v4

* chore: changeset
2025-02-05 21:28:49 +04:00
shadcn
6339aaa315 (7/n) shadcn: improve focus-visible for all elements (#6573)
* feat: focus visible colors

* fix: lint

* fix: tabs
2025-02-05 17:49:20 +04:00
shadcn
e2caa3cd35 chore: add v4 to changeset ignore 2025-02-05 15:03:19 +04:00
shadcn
c74a094f14 (6/n) shadcn: handle registry for v4 (#6571)
* feat(shadcn): hotswap registry style for v4

* chore: changeset

* style(shadcn): remove unused import

* chore: registry

* fix(shadcn): cmon
2025-02-05 14:54:24 +04:00
shadcn
bfb5b6357e feat: add vercel analytics 2025-02-05 11:34:14 +04:00
shadcn
ac3d965c6e chore: remove unused code 2025-02-05 11:33:10 +04:00
shadcn
6e7cd11d68 fix(v4): charts 2025-02-05 11:31:50 +04:00
shadcn
a75b4ca80e fix: build 2025-02-05 11:17:48 +04:00
shadcn
475abbbb20 refactor: new-york-v4 2025-02-05 10:38:28 +04:00
shadcn
762cd73554 chore: build registry 2025-02-05 10:17:03 +04:00
shadcn
8c06932800 fix: debug build 2025-02-05 00:37:50 +04:00
shadcn
e516481394 (5/n) shadcn: migrate all components and blocks (#6567)
* feat: add v3

* feat: upgrade lucide-react

* feat: upgrade components to Tailwind v4

* feat(v3): add dark mode

* wip

* feat: components upgrade

* style: format

* feat: add select

* feat: more components

* feat: more components

* fix: shadow

* feat: upgrade sidebar

* refactor: registry

* refactor: internal

* fix: registry

* fix: charts

* chore: build registry

* fix: charts

* feat: form

* feat: clean up

* fix: icons

* fix: command demo

* chore: add new-york-v4 to registry

* fix: revert command in www registry

* fix

* chore: fix tests

* fix: types

* fix: lint errors

* chore: build v4 registry

* fix

* fix: types
2025-02-05 00:15:07 +04:00
shadcn
d1eb24e23a (4/n) shadcn: fix handling of sidebar colors (#6515)
* fix(shadcn): background, foreground and sidebar colors

* chore: changeset

* ci: update artifact
2025-01-30 22:57:57 +04:00
shadcn
9a14c1d092 (3/n) shadcn: tailwind config (#6490)
* feat(shadcn): add tailwind version detection

* chore: changeset

* feat(shadcn): css vars for tailwind v4

* fix(shadcn): handle color space

* fix(shadcn): add oklch support

* feat(shadcn): handle single quote

* feat(shadcn): update tailwind config

* feat(shadcn): add keyframes

* feat(shadcn): add animation vars

* fix: var name

* fix(shadcn): handle color values

* feat(shadcn): handle radius

* feat(shadcn): clean up formatting

* feat(shadcn): update next clean up function

* chore: changeset

* feat(shadcn): fix formatting for v3 and v4

* test(shadcn): update snapshots

* fix(shadcn): update tailwind version handling
2025-01-30 11:59:47 +04:00
shadcn
5ef2bc5f45 (2/n) shadcn: css vars for tailwind v4 (#6487)
* feat(shadcn): add tailwind version detection

* chore: changeset

* feat(shadcn): css vars for tailwind v4

* fix(shadcn): handle color space

* fix(shadcn): add oklch support

* feat(shadcn): handle single quote

* chore: add changeset
2025-01-30 11:55:22 +04:00
shadcn
8f6a64f176 (1/n) shadcn: add tailwind version detection (#6478)
* feat(shadcn): add tailwind version detection

* chore: changeset
2025-01-30 11:49:09 +04:00
Boby Tiwari
e85920c191 Update blocks.mdx (#6477) 2025-01-28 16:25:24 +04:00
github-actions[bot]
c8c4027b6b chore(release): version packages (#6349)
* chore(release): version packages

* chore(release): version packages

* chore: fix version

* deps: update lock file

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: shadcn <m@shadcn.com>
2025-01-28 15:26:05 +04:00
shadcn
699195ba77 deps(shadcn): remove unused lodash.template (#6475)
* deps(shadcn): remove unused lodash.template

* chore: changeset
2025-01-28 15:13:39 +04:00
shadcn
9643db42cf feat: add docs for registry (#6380)
* chore: 2.2.0-canary.2

* feat: add docs for registry

* docs(www): update registry docs

* fix: update dep

* docs(www): update docs

* docs(www): update registry docs

* feat: add new label

* fix: lint
2025-01-28 15:06:22 +04:00
JEM
dd71498762 feat(sidebar blocks): adds sidebar-16 block with components and styles (#5889)
Introduces a new sidebar-16 block with an inset sidebar and site header navigation.
Includes components for main navigation, projects, secondary navigation, and user menu.
Updates registry and scripts to include the new sidebar block.

Addresses: #5629

![image](https://github.com/user-attachments/assets/769148aa-ec83-46f4-b4f0-77947e253d28)
![image](https://github.com/user-attachments/assets/38532b4d-21f6-4ce1-9e92-08edc4f72e46)
2025-01-27 12:40:45 +00:00
Jordan Cruz-Correa
ddf761e802 feat: add oklch color format support for /colors (#6441) 2025-01-24 17:53:45 +04:00
shadcn
5f7957ab51 feat(shadcn): add new registry:file type (#6377)
* feat(shadcn): add new registry:file type

* chore: add changeset

* fix: file target
2025-01-16 15:46:33 +04:00
shadcn
f07c7ad5d0 feat(shadcn): handle nested paths for components (#6369)
* feat(shadcn): handle nested paths for components

* chore: add changeset
2025-01-15 18:01:44 +04:00
shadcn
d5aa527f0b docs(www): add block preview image 2025-01-15 15:14:12 +04:00
shadcn
5ec990a474 docs(www): add blocks contribution docs (#6354)
* docs(www): add blocks contrib docs

* docs(www): update intro

* feat: update banner

* docs: add link

* docs: update block types
2025-01-14 21:56:45 +04:00
shadcn
cb742e9825 feat: add new registry build command (#6350)
* feat: implement shadcn/registry

* feat: add schema field

* fix: import

* chore: add changeset

* chore: remove console

* fix: tests

* fix: diff command

* feat: move to schema/registy-item.json

* fix

* ci: switch to node 20

* ci: build packages

* fix: types

* chore: update schema

* chore: update build registry script

* feat(shadcn): add build command
2025-01-14 15:59:41 +04:00
shadcn
254198b4bf feat: add shadcn/registry (#6339)
* feat: implement shadcn/registry

* feat: add schema field

* fix: import

* chore: add changeset

* chore: remove console

* fix: tests

* fix: diff command

* feat: move to schema/registy-item.json

* fix

* ci: switch to node 20

* ci: build packages
2025-01-14 10:50:19 +04:00
shadcn
1081536246 fix: path 2024-12-20 19:12:22 +04:00
shadcn
811bb59a8f feat(shadcn): monorepo support (#6104) 2024-12-20 19:07:17 +04:00
shadcn
ea677cc74e fix: open in v0 2024-12-17 23:14:59 +04:00
github-actions[bot]
9253b43f29 chore(release): version packages (#6094)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-12-16 23:56:28 +04:00
shadcn
c8fda09a63 feat(cli): detect and use next version (#6093)
* feat: detect and use next version

* chore: changeset
2024-12-16 23:53:40 +04:00
shadcn
1ff01b1bb5 fix(www): adjust reading width 2024-12-16 12:43:11 +04:00
shadcn
f10d59fee9 fix(www): themes page 2024-12-16 12:26:48 +04:00
shadcn
2f869a2590 feat(www): code blocks package manager (#6075)
* feat(www): code blocks

* fix: code style
2024-12-14 19:13:06 +04:00
LiuJie
102b0b0c62 fix: calendar icon components' props not use. (#5222)
* fix: calendar icon components' props not use.

* fix: calendar icon components' props not use.

* style: revert the original className order

* fix: calendar icon components' props not use.

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-12-14 15:16:52 +04:00
Ahad Rizvi
387756c4ab Remove unused imports from shadcn chart (#4391)
* Remove unused imports from shadcn chart

* chore: rebuild registry

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-12-14 15:03:01 +04:00
shadcn
05145e66d3 feat: refactor registry (#6071)
* feat(www): add login blocks

* chore(www): restructure for blocks

* chore: build registry

* chore: clean up chunks

* fix(www): chart categories

* feat(www): big registry refactor

* feat(www): update blocks

* feat: complex blocks

* fix: update schema

* feat: sync new-york and default

* fix: lint

* feat: move charts

* fix(www): code

* fix: src path

* chore: rebuild registry

* fix: screenshot

* fix: set new-york as default
2024-12-14 14:52:55 +04:00
shadcn
704991247c fix: ui imports for open in v0 (#6029) 2024-12-10 14:20:50 +04:00
github-actions[bot]
729b9ec8ca chore(release): version packages (#5812)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-12-10 12:17:32 +04:00
Jens Astrup
a1bed464f3 chore(apps): Update lodash (#4397)
* chore(apps): Refactor usage of lodash.template to lodash to address security vulnerability

* chore(cli): Refactor usage of lodash.template to lodash to address security vulnerability

* deps: update lock

* chore: changesets

* style: fix format

* fix: import

* chore: build registry

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-12-09 12:33:28 +04:00
shadcn
805ed4120a feat(www): refactor examples page (#5818) 2024-11-13 16:01:14 +04:00
shadcn
600a593c87 docs(www): update manual installation (#5817) 2024-11-13 15:42:52 +04:00
Braden Corbold
500dbe2664 fix(shadcn) arrays and nested deeply nested spread (#5711)
* fix: tailwind config updater parser

* fix: remove quote around spread element

* fix: specify deepmerge option for array

* fix(shadcn): Nested and spread array elements

* add test case for boolean primitive

---------

Co-authored-by: matsuyoshi30 <sfbgwm30@gmail.com>
Co-authored-by: shadcn <m@shadcn.com>
2024-11-13 15:19:21 +04:00
JEM
c577ee0666 docs(contributing): add CLI usage instructions (#5807)
Introduce a detailed workflow for running the CLI locally, ensuring contributors can easily test and develop enhancements in their local environment. This addition helps maintain consistency between CLI and component updates.
2024-11-13 15:17:11 +04:00
shadcn
d5bf0018fd fix(shadcn): handling of tsconfig aliases (#5813)
* fix(shadcn): handling of tsconfig aliases

* chore: add changeset
2024-11-13 15:15:22 +04:00
Tobbe Lundberg
fb36ca4159 fix(transform): Support aliases that are longer than one character (#5678)
* fix(transform): Support aliases that are longer than one character

* feat(shadcn): update handling of aliases

* chore: add changeset

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-11-12 22:13:38 +04:00
JEM
824a35ada1 test(snapshots): update test snapshots for consistency (#5801)
Updated snapshot components to use `React.ComponentProps` instead of custom interfaces for `input` and `Dialog` components. This simplifies the code by leveraging built-in React types, ensuring consistency and reducing potential errors arising from custom definitions.
2024-11-12 12:54:31 +04:00
shadcn
8d520c8d49 fix(www): figma link (#5798) 2024-11-11 20:08:24 +04:00
Temkin Mengsitu
0873835339 fix: ensure block component name is copied in shadcn (#5790) 2024-11-11 12:10:04 +04:00
JEM
4a0d4cfdb9 refactor(components): remove redundant empty interfaces from Input, Command, and Textarea components (#5657)
* refactor(components): remove redundant empty interfaces from Input, Command, and Textarea components

Simplified props handling by removing redundant empty interfaces (`InputProps`, `CommandDialogProps`, `TextareaProps`). Directly extended native HTML attributes/lib for each component, enhancing code clarity and maintainability. This refactor ensures compliance with ESLint rules and streamlines future modifications without altering component functionality.

* updated the registry

* rerun build:registry with updated command

* Refactor input and textarea components to use `React.ComponentProps`

* update registry
2024-11-08 20:26:01 +04:00
shadcn
c4c5d8d419 feat(www): update next-themes 2024-11-08 15:18:32 +04:00
Wing Chung Ng
9253682b87 refactor(www): update ThemeProviderProps type extraction for next-themes v0.4.0 compatibility (#5701)
Since next-themes v0.4.0 no longer provides types in `dist`, replaced the import of `ThemeProviderProps` from `next-themes/dist/types` with a new type extraction using `React.ComponentProps`. This change ensures continued type safety and compatibility with the updated library version.

Co-authored-by: shadcn <m@shadcn.com>
2024-11-08 15:16:10 +04:00
shadcn
c7cd16a637 fix(www): interactive chart 2024-11-07 21:36:19 +04:00
shadcn
eff1918d41 fix: update file handling 2024-11-07 21:21:42 +04:00
shadcn
366d6b656b fix(www): file tracing 2024-11-07 21:05:44 +04:00
shadcn
e489c5e08e fix(www): file tracing 2024-11-07 20:54:26 +04:00
shadcn
d87003e0a4 fix(www): sidebar 2024-11-07 20:40:18 +04:00
shadcn
a8633075f7 fix(www): component source 2024-11-07 20:36:21 +04:00
shadcn
432d5e6e28 fix: code view for mdx 2024-11-07 17:45:34 +04:00
shadcn
8f0c26f22a feat(www): code for blocks (#5756)
* feat: update blocks

* fix: scrollbars

* fix: code viewer

* test(shadcn): fix
2024-11-07 17:09:41 +04:00
shadcn
149b321c1b fix: lint 2024-11-06 17:34:21 +04:00
shadcn
c1ae5a57cc feat(www): nav color 2024-11-06 17:29:53 +04:00
shadcn
b8ed303d8c Merge branch 'main' of github.com:shadcn-ui/ui 2024-11-06 17:19:41 +04:00
shadcn
13c97acf9f fix: font size 2024-11-06 17:16:21 +04:00
shadcn
bed277c54d feat( www): minor updates (#5749)
* feat(www): update mode switcher

* feat(www): update layout

* feat(www): update theme-color handling

* fix(www): docs pages
2024-11-06 17:03:28 +04:00
github-actions[bot]
f7c42169a6 chore(release): version packages (#5733)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-06 00:19:13 +04:00
shadcn
2c2fe97eb9 feat: move new-york to lucide-react (#5602)
* feat: move new-york to lucide-react

* fix: mail open

* chore: update registry

* chore: add test:dev

* chore: add changeset

* feat: build an icon registry

* chore: add missing registry icons

* feat: add an icons debug page

* feat: add an icon migration

* chore(www): migrate all radix icons to lucide

* feat: update migration script

* chore: update changeset

* feat(shadcn): implement icons transformer

* fix: missing registry icons

* fix(shadcn): handling of missing icons

* feat: add support for multiple libraries
2024-11-06 00:00:41 +04:00
shadcn
d64374d009 fix(www): chart colors 2024-11-04 23:06:14 +04:00
github-actions[bot]
e24e51a2fa chore(release): version packages (#5709)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-04 17:25:59 +04:00
shadcn
cdfecd1d97 Revert "feat: remove npm flags" (#5707)
* Revert "feat: remove npm flags (#5686)"

This reverts commit 4ff64ba818.

* chore: temporarily bring back flag
2024-11-04 17:14:08 +04:00
manfromexistence04
2c043e709f fix: svg props casing to camelCase (#5691) 2024-11-03 19:27:28 +04:00
Ghribi Ouassim
aed19aa911 docs(www): added --all option to add command in cli docs page (#5591) 2024-11-03 14:37:08 +04:00
shadcn
9e35d229ae feat: www updates (#5688)
* feat: www updates

* fix: lint
2024-11-03 14:35:04 +04:00
shadcn
db1975ef4d Merge branch 'main' of github.com:shadcn-ui/ui 2024-11-03 13:27:19 +04:00
shadcn
961e0b62d7 fix: a11y for card and calendar 2024-11-03 13:27:10 +04:00
github-actions[bot]
70c684c224 chore(release): version packages (#5687)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-03 12:17:58 +04:00
shadcn
4ff64ba818 feat: remove npm flags (#5686)
* docs: update status table and docs

* feat(shadcn): remove react-19 check

* chore: add changeset
2024-11-03 12:12:41 +04:00
shadcn
500a353816 feat: update home page (#5648) 2024-10-30 21:28:58 +04:00
Nicholas Lim
c830780d62 docs(www): fix diff for peerDependencies (#5640)
Co-authored-by: shadcn <m@shadcn.com>
2024-10-30 17:23:06 +04:00
Felix Lu
debd51a854 refactor(sidebar): improve setOpen callback logic (#5593)
* refactor(sidebar): improve setOpen callback logic
- Simplify state handling
- Ensure consistent cookie setting
- Added ability for users to persist sidebar state via cookies
- Update sidebar.mdx doc with SSR persistence instructions
- Run pnpm registry:build to update component

* docs: updates

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-10-30 17:09:09 +04:00
shadcn
78426dd862 docs: fix diff 2024-10-30 16:31:44 +04:00
shadcn
6e47a94a8f chore: format 2024-10-30 15:40:46 +04:00
Barinderpreet Singh
ab6a856930 Docs: update vite installation docs (#4741)
* docs: update vite installation docs

* Update content config

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-10-30 15:37:32 +04:00
shadcn
b33d3868e9 docs(www): update status for radix icons (#5638) 2024-10-30 11:29:48 +04:00
Maou
9e0a86122a fix(docs): resolve link issue in documentation pages (#5633)
Updated broken link in documentation routing file. 
This ensures that the correct content is loaded based on the slug.
2024-10-30 07:10:15 +00:00
github-actions[bot]
2b276de95a chore(release): version packages (#5625)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-29 21:39:58 +04:00
shadcn
64739f8399 feat: react 19 (#5621)
* feat(shadcn): add flag prompt for npm

* docs: add docs for react 19

* chore: add changeset

* test: update snapshots

* docs: add notes for recharts

* docs: fix

* fix

* fix: linting
2024-10-29 21:30:05 +04:00
shadcn
f0cff7e0eb fix: gaps in command and dropdown-menu (#5570)
* fix: gaps in command and dropdown-menu

* chore: update snapshots
2024-10-25 18:13:13 +04:00
github-actions[bot]
e242adaa9c chore(release): version packages (#5568)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-25 17:52:32 +04:00
Kiyan
986c00ee0e fix: shadcn init with correct packageManager (#5299)
* fix: shadcn init with correct  packageManager

* chore: changeset

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-10-25 17:46:48 +04:00
shadcn
d0eece06d4 fix: update registry (#5530) 2024-10-23 17:35:26 +04:00
github-actions[bot]
0a0a566a4e chore(release): version packages (#5526)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-23 11:35:28 +04:00
Braden Corbold
bf5a79c4d4 fix(shadcn): fix transformRsc to account for ' (#5518)
* fix(shadcn): fix transformRsc to account for '

* chore: add changeset

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-10-23 11:33:11 +04:00
shadcn
f02b412478 fix(shadcn): temporarily pin create-next-app (#5525)
* feat: temporarily pin create-next-app

* chore: add changeset
2024-10-23 11:30:29 +04:00
DADDOU Mohamed El Amine
0d31293c7b docs: add missing installation step in the sidebar documentation (#5467) 2024-10-22 12:15:03 +04:00
Jacob Paris
3d1d19fc1b fix(sidebar): only apply text-sidebar-foreground to sidebar (#5491)
The text-sidebar-foreground class was applied to the SidebarProvider, which is designed to wrap the whole app, therefore making the whole app inherit its font color. This has been removed. The correct place for it is in the Sidebar component

Of the 3 possible return cases in the Sidebar component, 2 already applied the text-sidebar-foreground and I have added it to the third
2024-10-22 08:02:20 +00:00
BNaushad
e5b56c84a9 docs(sidebar): fix typo in sidebar documentation (#5487) 2024-10-22 11:42:38 +04:00
shadcn
630afe836e fix: sidebar provider 2024-10-21 12:38:51 +04:00
Jakob Ortmann
52c12bc27a fix import in sidebar example (#5438) 2024-10-21 11:46:27 +04:00
JEM
182f2083cd docs(sidebar): Fix sidebar toggle text for consistent behavior (#5428) 2024-10-21 11:45:11 +04:00
Phaired
3febcdc523 docs: fix type in sidebar.mdx (#5452) 2024-10-21 11:43:35 +04:00
EdamAmex
ced2513137 docs: fix prop name (#5460) 2024-10-21 11:43:08 +04:00
shadcn
93ae8bd67f chore: deprecate next-template (#5478)
* chore: deprecate next-template

* chore: tests
2024-10-21 11:40:54 +04:00
shadcn
3259fb7ca1 fix: overflow on icon 2024-10-19 01:28:07 +04:00
shadcn
d8397d80a8 chore: rebuild registry 2024-10-18 23:25:49 +04:00
shadcn
06e74fce78 Merge branch 'shadcn/sidebar-tsx'
# Conflicts:
#	apps/www/public/r/styles/default/use-mobile.json
#	apps/www/public/r/styles/new-york/button.json
#	apps/www/public/r/styles/new-york/dropdown-menu.json
#	apps/www/public/r/styles/new-york/use-mobile.json
#	apps/www/registry/new-york/ui/button.tsx
#	apps/www/registry/new-york/ui/dropdown-menu.tsx
2024-10-18 23:14:27 +04:00
shadcn
bc9e5eaaab test: fix 2024-10-18 22:52:25 +04:00
shadcn
c9b69d0836 docs: remove beta 2024-10-18 22:22:25 +04:00
shadcn
539212c49e feat: add redirect 2024-10-18 15:29:28 +04:00
shadcn
123887c36c fix: blocks 2024-10-18 00:54:19 +04:00
shadcn
35c1ba57c2 feat: add login-01 to v0 2024-10-18 00:34:03 +04:00
shadcn
b34516f471 fix: lint 2024-10-17 22:59:23 +04:00
shadcn
66b95402c1 feat: add v0 registry blocks 2024-10-17 22:58:20 +04:00
shadcn
5460177a7a fix: sidebar-07 2024-10-17 19:49:28 +04:00
shadcn
b0049c2266 fix: data-name 2024-10-17 17:13:47 +04:00
shadcn
4e6e21f094 fix: dark mode blocks 2024-10-17 17:01:24 +04:00
shadcn
3b808c83be fix: lint 2024-10-17 16:33:34 +04:00
shadcn
0e6b37e99a feat: update preview for mobile 2024-10-17 16:28:09 +04:00
shadcn
9ec433838f fix: lint 2024-10-17 01:11:00 +04:00
shadcn
444ff70590 feat: add notice 2024-10-17 01:06:35 +04:00
shadcn
27bc5deff1 docs: beta testers 2024-10-17 00:55:28 +04:00
shadcn
cacd7c8798 fix: use-mobile 2024-10-17 00:36:50 +04:00
shadcn
f227f93742 fix: sidebar 2024-10-17 00:34:50 +04:00
shadcn
87e099a3d7 feat: update button and dropdown menu (#5408) 2024-10-17 00:21:03 +04:00
shadcn
303d65718c chore: registry updates 2024-10-16 23:58:44 +04:00
shadcn
909219df14 docs 2024-10-16 15:33:16 +04:00
shadcn
e8ada4e3c7 docs 2024-10-16 14:33:43 +04:00
shadcn
8fc80836ff docs 2024-10-16 12:54:21 +04:00
shadcn
d0a308cc64 fix: edit in v0 2024-10-16 11:12:58 +04:00
shadcn
e461c02389 feat: update open in v0 2024-10-15 21:28:38 +04:00
shadcn
50c2f6045a chore: fix lint 2024-10-15 12:52:40 +04:00
shadcn
14aca65eee docs: add sidebar docs 2024-10-15 12:49:22 +04:00
shadcn
14c952b594 chore: update registry 2024-10-15 12:41:20 +04:00
shadcn
1e9434e6f9 chore: build registry 2024-10-15 12:38:45 +04:00
shadcn
f3d14c48cb feat(www): update button and tooltip 2024-10-15 12:38:32 +04:00
shadcn
c668c35bb9 feat(www): add sidebar components 2024-10-15 12:37:47 +04:00
shadcn
1297abc882 fix: v0 2024-10-07 21:13:33 +04:00
shadcn
36ebbf26dc docs(www): update figma 2024-09-29 14:52:52 +04:00
github-actions[bot]
a2abc4ad95 chore(release): version packages (#4963)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-27 22:10:05 +04:00
Thomas Raffray
4b546bfb13 fix(cli): remix detection (#4972)
# What

Some remix templates doesn't package a `vite.config.*` file at their root.
It's the case for the recommended starter "stack" templates: blues-stack, indie-stack and grunge-stack.
As recommended in a TODO comment, it's more suitable to check for a `@remix-run/*` dependency in the package dependencies.

# How

- decouple vite and remix checks
- retrieve the `package.json`
- allow passing a `cwd` to the retrieval method
- remove the "empty config file list" that can be empty for a remix stack
- check that the `package.json` contains a `@remix-run/*` dependency

# Test

Added a fixture by running `npx create-remix@latest --template remix-run/indie-stack` in the [frameworks](/Fluf22/shadcn-ui/tree/fix/cli-remix-detection/packages/cli/test/fixtures/frameworks) folder and named it `remix-indie-stack`, if ever we want another stack as a fixture later

---

Fixes shadcn-ui/ui#4967
2024-09-27 17:58:46 +00:00
shadcn
5fc9ade413 chore(cli): add deprecation notice (#4988)
* feat(cli): add deprecation message

* chore: changesets
2024-09-27 17:43:16 +04:00
Nami Sunami
96880e7c9a fix: Fix the typo in error messages (component.jsoncomponents.json) (#4977)
* fix(prompt): fix error message, component.json -> components.json

* fix(config): fix the error message, component.json -> components.json

* chore: changeset

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-09-27 16:01:04 +04:00
Artem Zakharchenko
7dfdb029e7 use "?url" suffix in "tailwind.css" import (Remix) (#4945)
Importing `tailwind.css` is incorrect as it will treat that file as a CSS Module, throwing that it has no `default` export. 

Instead, the tutorial relies on the import returning a _URL_ to the stylesheet. Adding `?url` to the import specifier is the way to go.
2024-09-26 12:42:49 +00:00
shadcn
28f34ed3c3 feat(shadcn): recursively resolve registry dependencies (#4961)
* feat(shadcn): recursively resolve registry dependencies

* chore: add changeset

* ci: update actions/upload-artifact
2024-09-25 22:56:39 +04:00
github-actions[bot]
bd54184e60 chore(release): version packages (#4938)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-23 15:21:55 +04:00
Braden Corbold
ce3adfa075 fix(shadcn): Support single quote formatted registry files (#4870) (#4871) 2024-09-23 11:47:37 +04:00
Shivang Rathore
674807c1b4 fix(shadcn): Ensure .scss files are considered in init command (#4866)
Co-authored-by: shadcn <m@shadcn.com>
2024-09-23 11:44:27 +04:00
sapenlei
c62167a449 fix(shadcn): default next styles are not completely cleared (#4922)
* fix(shadcn):  default next styles are not completely cleared

* chore: add changeset

* fix(shadcn): tests

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-09-23 11:38:59 +04:00
github-actions[bot]
061083006f chore(release): version packages (#4857)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-15 13:40:31 +04:00
Jack Herrington
1af66c2d08 Adding support for ~ in target specification (#4848)
* Adding support for ~ in target specification

* test(shadcn): add a test for srcDir false

* chore: changeset

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-09-15 13:27:48 +04:00
shadcn
0993d98cc7 ci: update stale config (#4858) 2024-09-15 13:25:06 +04:00
Hichem Fantar
52d223393a (fix Input) choose file text color in dark mode (#4843)
This pull request fixes the issue with the choose file text color in dark mode. The changes ensure that the text color is correctly displayed in dark mode.

the reason this bug doesn't happen in the shadcn website is because it sets `color-scheme:dark` on the document;

this fix makes sure this always works even if color scheme isn't set.

Closes #4842

![image](https://github.com/user-attachments/assets/37cb3f2a-c1a7-49b3-8ef1-77823dd7bd45)

![image](https://github.com/user-attachments/assets/92913fec-5651-4cfc-8e16-2f12c06c33b8)
2024-09-15 09:20:19 +00:00
Shivang Rathore
207b69fe8d fix(cli): Ensure .scss files are considered in getTailwindCssFile (#4797)
* fix(cli): Ensure .scss files are considered in getTailwindCssFile

- Updated getTailwindCssFile function to include .scss files when checking for Tailwind CSS configuration.
- This change ensures that .scss files are properly identified and handled, improving compatibility with projects using SCSS.

* chore: add changeset

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-09-15 12:55:08 +04:00
Rana Haris Ali
408760a93b fix: correct grammar in "path does not contain a package.json" message (#4815)
* fix: correct grammar in "path does not contain a package.json" message

* chore: add changeset

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-09-15 12:51:23 +04:00
Devansh Mahant
a9ab7afebf Fix Incorrect Hook Import Path in Toast Component Example in ShadCN Docs (#4811)
#### Summary:
This pull request addresses a documentation error found in the ShadCN website's Toast component example. Specifically, the import route for the hook is incorrect in the example. and fixes [#4816](https://github.com/shadcn-ui/ui/issues/4816)

#### Issue:
Upon reviewing the [ShadCN Toast documentation](https://ui.shadcn.com/docs/components/toast), I found that the import path for the Toast component hook was wrongly mentioned as being located in the `components` folder. According to the `component.json` file, the correct location of the hook is within the `hooks` folder inside the main directory.

#### Fix:
- Corrected the import path in the Toast component example from `components` to `hooks`, as per the `component.json` file structure.

#### Example of Fix:
**Before:**
```js
import { useToast } from "@/components/use-toast";
```

**After:**
```js
import { useToast } from "@/hooks/use-toast";
```

#### Testing:
- Verified that the corrected path resolves correctly.
- Ensured the example works as expected after the change.

#### Impact:
This fix prevents confusion for users following the example and ensures that the import path accurately reflects the project structure, improving the overall developer experience.
2024-09-15 08:45:29 +00:00
Quinn Blenkinsop
b6221ea524 fix(www): update broken link to headless ui (#3542)
The link appears to have broken at some point, I've updated it

Co-authored-by: shadcn <m@shadcn.com>
2024-09-15 12:31:28 +04:00
github-actions[bot]
9ef7967b0d chore(release): version packages (#4821)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-12 17:54:41 +04:00
shadcn
64b2f1a5ad feat(shadcn): add experimental docs (#4820)
* feat(shadcn): add cli docs

* chore: add changeset

* fix: tests
2024-09-12 17:51:59 +04:00
github-actions[bot]
f4ca57a79c chore(release): version packages (#4788)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-09 12:34:19 +04:00
shadcn
99ff9caf71 fix(shadcn): add src to content in tailwind config (#4787)
* feat(shadcn): handle src dir

* chore: changeset
2024-09-09 12:32:12 +04:00
github-actions[bot]
cd9a55b76a chore(release): version packages (#4777)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-07 23:42:29 +04:00
shadcn
49373eed96 fix(shadcn): better error handling (#4776)
* fix(shadcn): better error messages

* chore: changeset
2024-09-07 23:35:37 +04:00
shadcn
078dfe6607 docs(www): Open in v0 docs (#4734)
* feat(www): open in v0

* feat: update copy

* fix: sidebar link

* fix(tests): snapshots
2024-09-04 00:37:57 +04:00
xuxucode
77fc5ec8db Fix use-toast module path (#4728) 2024-09-03 18:37:11 +00:00
github-actions[bot]
cfba3fdf70 chore(release): version packages (#4730)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-03 22:22:26 +04:00
adrianhelvikspond
4e4118f3cf Fix init command for default style - fixes #4722 (#4724)
* Fix init command for default style

The empty dependency string was tripping up package managers.

* fix(www): registry dependencies for default

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-09-03 22:21:51 +04:00
shadcn
faa7a67fb3 fix(shadcn): init with src (#4731)
* fix(shadcn): init with src

* chore: add changesets
2024-09-03 22:16:59 +04:00
shadcn
701e1160ea feat(shadcn): add support for src dir (#4729)
* feat(shadcn): add support for src dir

* chore: add changesets
2024-09-03 21:47:15 +04:00
shadcn
f5931f8d09 docs(www): update installation docs (#4725) 2024-09-03 16:41:48 +04:00
shadcn
5a28937c6e Merge branch 'main' of github.com:shadcn/ui 2024-09-03 16:35:51 +04:00
shadcn
0b74059d38 docs(www): update laravel docs 2024-09-03 16:35:36 +04:00
shadcn
fab9877586 fix(shadcn): handle quote in theme values (#4726)
* fix(shadcn): handle quote in theme values

* chore(shadcn): fix theme values bug
2024-09-03 16:22:45 +04:00
shadcn
0f7591f67c docs(www): updates docs for Astro (#4723) 2024-09-03 15:35:24 +04:00
shadcn
81c7e44863 fix(www): url 2024-08-31 03:15:10 +04:00
shadcn
2fac3e40c2 fix(www): hide sidebar-01 for now 2024-08-31 03:10:14 +04:00
shadcn
5ad11ff851 docs(www): update callout 2024-08-31 03:01:42 +04:00
shadcn
6b92dd8eaf Merge branch 'main' of github.com:shadcn/ui 2024-08-31 02:57:49 +04:00
shadcn
84540f551d fix: blocks 2024-08-31 02:57:37 +04:00
shadcn
99588fff8f fix: cli (#4669) 2024-08-31 02:09:14 +04:00
github-actions[bot]
f99cd2aa5d chore(release): version packages (#2597)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-31 02:02:06 +04:00
shadcn
a62a155aac (1/N) cli: framework support (#4569) 2024-08-31 01:54:48 +04:00
shadcn
dc8853c8df chore: rebuild registry 2024-08-30 23:50:06 +04:00
shadcn
259a9ff56a Open in v0 (#4613)
* feat: edit in v0

* feat: update edit sources

* fix: edit button

* feat: rename to open in v0
2024-08-21 23:42:03 +04:00
Sangram Bahadur
9f156a1b89 fix: Playground example model selector working (#4507)
Issue: 
The ModelItem component's onPeek handler was sometimes logging incorrect data, causing the model selector to appear inconsistent.

Changes Made:
Verified that the aria-selected attribute is true before calling onPeek(model), ensuring the function is only called when the element is actually selected.

Fixed Model Selector Inconsistency in Playground Example

fixes #4506
2024-08-07 07:44:30 +00:00
Azhar Zaman
f2e33415c6 fix(www): combobox examples error (#4503)
* bug-fix: added command-list component to eliminate error

Wrap CommandEmpty and CommandGroup inside CommandList
Eliminated Error: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))

* fix(www): command examples

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-08-06 01:42:26 +04:00
Justin Nguyen
59a931055f fix(command): disabled items and cmdk 1.0.0 (#2945)
* fix: fix breaking changes for Command component that comes with cmdk 1.0.0

* chore: build registry

* chore: moving paths for some examples

* chore: moving paths for some examples

* chore: use data instead of aria

* fix: update command and pin cmdk

* fix: model selector

* fix: command for new york

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-08-05 15:28:14 +04:00
Erdiansyah
59f2d558b6 docs: Fix docs dark-mode astro.mdx (#4491)
remove redundant script closing tag
2024-08-03 20:54:17 +00:00
Liron Abutbul
4a77cdc41c fix(www): remove unused import (#4324) 2024-08-04 00:35:04 +04:00
Jai Prakash Kaushik
e42f55f8e3 fix(www): min width for mail example (#4437)
Co-authored-by: Jai Prakash Kaushik <jaiprakash02082001@gmail.com>
Co-authored-by: shadcn <m@shadcn.com>
2024-08-04 00:17:49 +04:00
Jaeung Jang
6cc38903b8 fix: missing close tag for command (#4330)
* fix: missing close tag for command

* docs(www): fix formatting

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-08-04 00:06:52 +04:00
shadcn
32e4b78da8 fix(www): mail 2024-07-24 13:02:42 +04:00
shadcn
2cef110f45 Merge branch 'main' of github.com:shadcn/ui 2024-07-24 12:44:26 +04:00
shadcn
79254d6b80 fix(www): mail example 2024-07-24 12:44:19 +04:00
shadcn
6e2d83bf42 fix: pin react-day-picker (#4387) 2024-07-23 11:14:14 +04:00
Diogo Martino
cc70f6ef43 docs: add missing command (#4301) 2024-07-18 11:45:39 +04:00
shadcn
d3fec64031 chore: remove precommit hooks (#4319) 2024-07-17 20:28:10 +04:00
shadcn
12539b3664 feat(www): tooltip examples (#4309)
* feat(www): more chart examples

* feat(www): add tooltip examples

* feat: add themes support on blocks page

* chore: build registry

* fix: colors on charts

* fix: styles

* fix: downgrade rehype-pretty-code

* chore: fix

* fix: frame

* fix: code

* feat: update charts nav

* fix: use client

* feat: update all charts
2024-07-17 19:22:38 +04:00
shadcn
210010f5ed more chart examples (#4304)
* feat(www): more chart examples

* feat: add themes support on blocks page

* chore: build registry

* fix: colors on charts

* fix: styles

* fix: downgrade rehype-pretty-code

* chore: fix

* fix: frame

* fix: code
2024-07-17 18:58:40 +04:00
Rubin Bajracharya
cc5e07b60b fix: typo in theme template causing blank color values. (#4315)
Typo fix to get proper value when pressing copy code in theme customizer section.

Link for Issue: https://github.com/shadcn-ui/ui/issues/4314
2024-07-17 08:47:50 +00:00
Andy Hsu
29150e576a fix(docs): incorrect link on charts page (#4305) 2024-07-16 20:24:05 +04:00
xSenny
5b856127ee fix(www): update height of chart in preview (#4244)
Co-authored-by: shadcn <m@shadcn.com>
2024-07-16 14:53:32 +04:00
Jenia Brook
93808ab561 Use double-quotes instead template literals (#4286)
Just for consistency 🙏
2024-07-15 08:50:18 +00:00
Leo Lin
58637a34d1 chore(www): update indentation in build script (#4293)
Co-authored-by: shadcn <m@shadcn.com>
2024-07-15 12:34:07 +04:00
Ethan Brown
dd9900ba0e docs(www): update Vite instructions (#4260) 2024-07-15 12:33:40 +04:00
shadcn
650b3b9bda chore(www): switch to contentlayer2 (#4292)
* chore(www): switch to contentlayer2

* chore: rebuild registry

* fix: build
2024-07-15 12:18:58 +04:00
Sushant Mishra
238e492181 fix(docs): resolve imports for IDE (#4275)
IDE uses the config mentioned in the `tsconfig.app.json` file whereas shadcn uses the config mentioned in the `tsconfig.json` file for path resolution 

Before adding the path to `tsconfig.app.json`

![image](https://github.com/user-attachments/assets/749c99f9-8d96-44f4-922b-c0a08623d104)


After adding the path to `tsconfig.app.json`

![image](https://github.com/user-attachments/assets/f5bef190-94e6-4c3e-8a7b-82f3ae3f9396)

This commit mentions the same in the installation with `vite` docs
2024-07-15 06:57:48 +00:00
Ariel
f170784f78 bug fix: type error in chart.tsx (#4230)
# Current Issue
when running `next lint`, the typescript compiler fails on the chart component (closes #4229 )
`Type error: Type 'string[]' is not assignable to type 'string | TrustedHTML'.`

# Resolution

We can coerce the `string[]` into a valid type by `join`ing.
2024-07-11 13:14:44 +00:00
Mariano Álvarez
03b1d783c4 feat: add chart colors to theme customizer (#4237)
# Description

This PR adds support for customizing graphics themes in the `ThemeCustomizer` component. Users can now select and copy chart colors (`chart-1`, `chart-2`, `chart-3`, `chart-4`, `chart-5`) along with other themes.

## Changes Implemented

1. **Themes Update**: Added chart themes (`chart-1`, `chart-2`, `chart-3`, `chart-4`, `chart-5`) to the chart file. themes configuration (`themes.ts`).
2. **Modification of the `ThemeCustomizer` Component**: The new graphics themes were integrated into the component so that they can be selected and copied.
3. **CSS Tweak**: Updated the functions that generate CSS code to include the new graphics themes.

## How to Test

1. Run the project locally.
2. Navigate to the `ThemeCustomizer` component.
3. Verify that the new graphics themes are available for selection.
4. Test the functionality of copying the CSS code and making sure it includes the graphics colors.

## References

- Added support for graphics themes based on defaults provided by Shadcn.
2024-07-10 12:56:38 +00:00
rds_agi
36a9c1bb71 Fixed all issues related Command component (#4154)
# Fix Command Component issues and update documentation

## Changes
- Resolve Command Component issues by wrapping `<CommandGroup />` inside `<CommandList>`
- Update deprecated docs in `combobox.mdx` to reflect latest `<Command />` component usage

### Code Changes
From:
```tsx
<Command>
  ...
  <CommandGroup>
    ...
  </CommandGroup>
</Command>
```
To:
```tsx
<Command>
  ...
  <CommandList>
    <CommandGroup>
      ...
    </CommandGroup>
  </CommandList>
</Command>
```

## Visual Comparison
Before & After comparison: 

https://github.com/shadcn-ui/ui/assets/77154365/156b7180-54e6-45aa-8934-b4fb99e6160e

## Summary
By wrapping `<CommandGroup />` inside `<CommandList>{children}</CommandList>`, all issues related to the Command Component have been resolved.
2024-07-10 12:40:55 +00:00
liruifengv
949e6f65ef fix type import in toggle-group.tsx (#4234)
## description

fix type import in toggle-group.tsx
2024-07-10 12:40:38 +00:00
Howard Chiam
dbbb2a427e docs: minor typo in the first page's FAQ (#4174)
Co-authored-by: shadcn <m@shadcn.com>
2024-07-10 16:37:11 +04:00
Christian F
1369d3ca96 Update data-table.mdx (#4153)
Docs link was broken ...
2024-07-10 12:24:25 +00:00
shadcn
984c4d8912 feat: add colors page (#4238) 2024-07-10 16:11:38 +04:00
Batuhan Tomo
248347a389 fix: Update ChartTooltipContent to handle "0" item value (#4215)
Fix #4214: Update ChartTooltipContent to handle "0" item value
2024-07-10 12:08:25 +00:00
OGPowell
f6ad10abd5 docs(www): fix typo (#4232) 2024-07-09 21:08:37 +04:00
shadcn
f0093d6a41 feat: add chart colors to base colors (#4228)
* feat: add chart colors to base colors

* fix: format
2024-07-09 15:29:20 +04:00
shadcn
c1b955444d fix: deps 2024-07-06 02:13:35 +04:00
shadcn
4ac9db98fe Charts (#4181) 2024-07-06 02:06:40 +04:00
shadcn
06cc0cdf3d fix(www): combobox 2024-06-03 21:22:36 +04:00
kevinmitch14
4aa8b02980 feat: bump cmdk + use data attributes for styling (#2626)
* feat: bump `cmdk` + use data attributes for styling

* refactor: bump again

* Merge remote-tracking branch 'upstream/main' into cmdk-bump-and-styles

* Revert "Merge remote-tracking branch 'upstream/main' into cmdk-bump-and-styles"

This reverts commit d74be6bb60.

* chore: sync `pnpm-lock`
2024-06-03 12:12:37 +04:00
Ricardo Raposo
13d9693808 fix: quick fix to data attribute at CommandPrimitive.Item that was applying a disabled state style all the time (#3680)
Data attributes at <CommandPrimite.List /> component should be written as data-[disabled=true] in order to avoid styles being applied to element, even when it's not disabled.
2024-05-13 05:01:29 +00:00
shadcn
816b654f07 fix(www): update heading font size 2024-04-22 00:19:11 +04:00
Luca Félix
9aaaf429d9 fix: 🐛 lift mode duplicate ids lead to incorrect behavior (#3433)
## Bug:

When clicking on the "Lift Mode" Text instead of the toggle itself, since there were multiple `lift-mode` ids before (one for each block), the incorrect toggle would be activated.

https://github.com/shadcn-ui/ui/assets/61006057/261ec82f-9274-4e0a-ac21-5e3aa3ceece3

## Fix:

Instead of the id being static I changes the `id`, as well as the `htmlFor` attributes to `lift-mode-${block.name}`. This prevents duplicate ids, as long as there are no two blocks with the same name.
2024-04-18 06:14:13 +00:00
shadcn
afc553d8f8 fix: edit components 2024-04-17 23:05:45 +04:00
shadcn
11c31af94f feat(www): add description and edit in v0 to examples (#3518)
* feat(www): add description and edit in v0 to examples

* fix: missing icon
2024-04-17 22:14:40 +04:00
shadcn
bebc2843f0 fix(www): remove unused chunk 2024-04-09 21:10:49 +04:00
Aakash
bf0c8b596b fix(blocks): replace code with @/components/ui imports while copying from lift-mode (#3401)
FIXES : https://x.com/jimmeyer/status/1776487418150981661?s=46

The copy button in lift mode was copying code having imports as "@/registry/.../*.tsx" 

This PR replaces all the imports by "@/components/ui/*.tsx"
2024-04-08 17:25:46 +00:00
shadcn
7590fb7636 feat: lift mode (#3380)
* feat(www): wip break everything

* feat(www): wip chunks

* feat(www): wip chunk mode

* feat: lift mode

* feat: update chunks

* fix: resize in lift mode

* fix: hasLiftMode

* fix: types

* fix: toolbar

Thanks @mrnbpt

* chore: format check

* feat: add tracking for enable_lift_mode

* chore: format write

* docs: add changelog
2024-04-05 21:28:05 +04:00
shadcn
f47bb973be feat: e-commerce dashboard blocks (#3236)
* feat(blocks): add e-commerce dashboard

* feat(blocks): add products pages

* style(blocks): run prettier

* feat(www): update dashboard-05

* feat(www): update gap for dashboard-05

* feat(www): update dashboards

* fix(www): review a11y for new blocks

* fix(blocks): a11y for dashboard-07

* fix(www): blocks background

* chore: update registry
2024-03-29 00:14:32 +04:00
shadcn
9813c59886 fix(www): update url for request a block 2024-03-26 09:34:05 +04:00
shadcn
9044d890ec chore: rename blocks_request.yml to blocks-request.yml 2024-03-26 09:20:32 +04:00
shadcn
3bc3d3849c chore: rename block_request.yml to blocks_request.yml 2024-03-26 09:19:59 +04:00
shadcn
ebc9f710f6 chore: update block_request.yml 2024-03-26 09:17:03 +04:00
shadcn
eda92749e9 chore: convert issue_template to discussion_template (#3156) 2024-03-26 09:15:35 +04:00
shadcn
c86f1bd8b8 chore: update bug_report.yml 2024-03-26 08:48:46 +04:00
Zero
1da3e740e4 fix(dashboard-3): align aside and header borders in default style (#3137) 2024-03-26 08:46:03 +04:00
Yan Lyra
5c50a32e8f chore(vaul): upgrade vaul version to a more recent (#3134)
It also fix #3093
2024-03-25 12:26:39 +00:00
shadcn
7c3da3e348 fix: display of txt code block (#3149) 2024-03-25 16:16:40 +04:00
keremcs
d4872067a6 fix: authentication-03 block misalignment (#3101)
* Update authentication-03.tsx

* new york
2024-03-25 08:22:03 +04:00
Ishaan Dey
37c726e60e fix: dashboard-02 block (shadcn-ui#3098) (#3099) 2024-03-23 15:01:04 +04:00
shadcn
79c054ac7a feat: blocks (#3094) 2024-03-22 21:39:33 +04:00
Dominik Ferber
3a4c3b2f7d fix nextjs docs (#3075) 2024-03-21 13:38:21 +04:00
shadcn
f199dd3bbf feat: switch input-otp to composition (#3052)
* feat: switch input-otp to composition

* feat: add disabled
2024-03-19 10:25:06 +04:00
Luca Félix
5ec881d176 fix: 🐛 breadcrumb file paths code preview (#2946)
Co-authored-by: shadcn <m@shadcn.com>
2024-03-13 08:38:17 +04:00
kevinmitch14
3f76d5fdc2 fix: use ?? instead of || (#2941)
Co-authored-by: shadcn <m@shadcn.com>
2024-03-11 19:42:27 +04:00
shadcn
1f0a7008d6 docs(www): update chancelog 2024-03-08 06:04:57 +04:00
shadcn
c04f1cac2d docs: update changelog (#2937)
* docs(www): changelog

* docs(www): update changelog
2024-03-07 23:56:37 +04:00
shadcn
e8856d1dea feat: add input-otp (#2919)
* feat: add input-otp

* feat: update input-otp and add examples

* feat(input-otp): add controlled and form examples

* chore(input-otp): update to latest

* docs(www): fix example code for input-otp

* fix(www): disable menu
2024-03-07 22:57:33 +04:00
its-monotype
7f0af435e1 feat(breadcrumb): add breadcrumb component (#133)
* feat(breadcrumb): add breadcrumb component

* refactor(breadcrumb): improve variable name and simplify object key passing

* refactor(breadcrumb): remove unnecessary color transition

* chore(breadcrumb): wip

* chore: build registry

* feat: update breadcrumb component

* fix(breadcrumb): update code highlight

* chore(www): remove menu

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-03-07 22:42:39 +04:00
shadcn
3f5f361d19 chore: update feature request template 2024-03-03 15:38:02 +04:00
shadcn
206ca548d3 chore: update bug report template 2024-03-03 15:36:02 +04:00
Gram Liu
59412bbb08 fix(components): Add "use client" directive to Toast (#2048)
Resolves #2025

This adds the "use client" directive to the Toast component, since it makes use of client-only features like `useState`. When absent, this causes errors in rendering as described in the issue.
2024-03-03 11:33:30 +00:00
David
a9f7b8d66d Implement #2609. (#2610)
Co-authored-by: shadcn <m@shadcn.com>
2024-03-03 15:29:47 +04:00
alpaca
2de7bbf32e docs(next-installation): Fixed type error in Next.js installation by removing export from fontSans (#2673)
This PR fixes the issue [#2337](https://github.com/shadcn-ui/ui/issues/2377).

I removed `export` of `fontSans` from `app/layout.tsx`, which was causing a type error. 
I have ensured that this modification does not impact other functionalities. Your feedback on this pull request would be greatly appreciated.

Thank you for your consideration.
2024-03-03 11:03:04 +00:00
shadcn
0fae3fd93a ci: update stale issue label and days before close (#2662) 2024-02-04 12:27:36 +04:00
Șener Ali
f859d4857e feat(components): skeleton example (#2036)
Co-authored-by: Sener <sener@MacBook-Pro-3.local>
2024-01-28 13:23:06 +04:00
Gravy59
f3ff4a4fc3 fix(build): replace ts-node with tsx to resolve issues with modules (#1977)
This pull request resolves #1926 and prevents issues like it from happening in the future

## Rationale for this PR

This PR changes the TypeScript execution package for use in scripts like `build:registry` from `ts-node` to `tsx`. This is because `ts-node` has many difficult quirks to work through (and is slow). In addition, it also has a difficult to understand error for newcomers that *is* reproducible.

### The ts-node error

As shown in #1926, using `ts-node` (specifically in `build:registry`) results in this error: `Unknown file extension ".ts" for /ui/apps/www/scripts/build-registry.ts`. There are many issues in the `ts-node` repository documenting this problem:
* TypeStrong/ts-node/issues/1062
* TypeStrong/ts-node/issues/2033
* TypeStrong/ts-node/issues/1997

Switching the typescript-in-node system to `tsx`, which uses esbuild under the hood, resolves this error.

This PR shouldn't affect tests, representation, etc. and is merely a change of build tools. There is no urgent need to merge this.

I accidentally deleted the head repository on #1937. That will not happen again.
2024-01-28 09:18:18 +00:00
Rakibul Islam
9a9c5b1faa fix #2008 (#2009)
Co-authored-by: shadcn <m@shadcn.com>
2024-01-28 13:02:00 +04:00
kevinmitch14
343b20fc5c refactor: update zod imports in /cli (#2473)
updates in /cli
2024-01-28 08:57:26 +00:00
shadcn
ee94767dba ci: add stale issue workflow (#2595) 2024-01-28 12:47:58 +04:00
kevinmitch14
7df1007a5b refactor: update zod import (#2466) 2024-01-28 12:47:45 +04:00
Thomas Marrec
a465432a66 fix(carousel): adjust types for embla-carousel-react@8 (#2326)
Fixes #2322 , #2281 

Thanks to @akynau & @nianiam
2024-01-18 07:22:45 +00:00
Oguz Kazkayasi
7822e06904 Adds missing display names to Pagination Elements (#2178)
* fix: add missing pagination names

* chore: build registry

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-01-18 11:08:25 +04:00
Takeshi Kriang
578d2c1823 fix(pagination): remove incorrect nested li from pagination link (#2190)
* feat: remove PaginationItem

* chore: build registry

---------

Co-authored-by: shadcn <m@shadcn.com>
2024-01-18 10:58:22 +04:00
github-actions[bot]
29de71d77f chore(release): version packages (#2458)
* chore(release): version packages

* Update CHANGELOG.md

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: shadcn <m@shadcn.com>
2024-01-16 23:56:19 +04:00
shadcn
0374ba874d feat(cli): add min-config support for Next.js (#2454)
* feat(cli): add zero-config support for Next.js

* chore: add changeset

* feat(cli): add preflight
2024-01-16 22:05:39 +04:00
github-actions[bot]
59b2cc8142 chore(release): version packages (#2420)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-01-14 16:06:43 +04:00
Vulcan-Coder
0e721be8dd Update models.ts (#2374)
Fixed the space at the start of the UUID
2024-01-14 11:27:26 +00:00
shadcn
7640ef7bbc feat: add support for adding devDependencies in the cli (#2419)
* feat(cli): add support for install devDependencies

* chore: add changeset
2024-01-14 15:21:57 +04:00
김태강
8f3b28f50f feat(components): add "use client" directive to carousel, resizable component (#2319)
[Reopen a PR that was accidentally closed.](https://github.com/shadcn-ui/ui/pull/2233)
carousel, resizable components to be used by the app router, a "use client" directive is required.
2024-01-07 09:24:23 +00:00
vinay
73be841162 [Docs] Update CLI options while configuring components.json (#2283)
New Line added to the docs.
Just for the consistency.

![image](https://github.com/shadcn-ui/ui/assets/94120295/e0da71c1-72d1-4e5d-bba9-54634a9d0e31)
2024-01-07 09:23:35 +00:00
Nuriman Quddus
ad32fdeb7d fix: typo on carousel import (#2216)
# What's changed

- [x] Fixed the typo on carousel component

before fix: "@/registry/new-york/ui/carousel"
after fix: "@/components/ui/carousel"

this is ease the user to copy paste without error
2024-01-07 08:04:54 +00:00
Clarence
2dd7864007 fix: Github case correction (#2268) 2024-01-07 07:59:20 +00:00
Andrew Qiao
5d37bae1b8 fix(www): incorrect toggle aria labels and values (#2163)
- some `Toggle` and `ToggleGroup` demos had incorrect `aria-label` or `value` props
2024-01-07 07:49:26 +00:00
Chase
4b59cb812e fix(docs): Resizable panel direction should be horizontal (#2295)
In the [resizable documentation](https://ui.shadcn.com/docs/components/resizable) the handle example shows a horizontal handle but the code example has `direction="vertical"` when it should be `direction="horizontal"`

<img width="745" alt="Screenshot 2024-01-05 at 9 34 43 AM" src="https://github.com/shadcn-ui/ui/assets/7241069/68c21241-e0c7-41b1-81d7-579306149520">
2024-01-07 07:43:51 +00:00
Anshul Kanwar
4b200ebf59 docs: typo in drawer, dialog and sheet (#2306) 2024-01-07 07:26:21 +00:00
Tilak Thapa
33795426dd Fix: Add e.preventDefault() to prevent page reload (#2278)
Fixes #2277

Add `e.preventDefault()` to prevent page reload in mail component

![image](https://github.com/shadcn-ui/ui/assets/106688422/d1373e8f-0c46-4f2e-8caf-2fcd2076b2fb)
2024-01-07 07:17:47 +00:00
github-actions[bot]
fb614ac292 chore(release): version packages (#2269)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-01-02 22:42:42 +04:00
shadcn
be580dbf76 feat(cli): add support for custom ui dir (#2266)
* feat(cli): add support for custom ui dir

* docs(www): update docs for aliases.ui

* chore: add changeset
2024-01-02 22:32:15 +04:00
shadcn
98859e7b1c feat(www): update keyboard handling for command menu (#2264) 2024-01-02 11:48:27 +04:00
kal07
6b523b60db Update pagination.mdx (#2191)
fix the Nextjs import example
2023-12-26 14:23:04 +00:00
Ghribi Ouassim
e3d5377a3e Added new label for mobile navigation (#2182)
- Update the `mobile-nav` component and added `new` label if `item.label` is present in the `docsConfig.sidebarNav`.

![image](https://github.com/shadcn-ui/ui/assets/70029024/e19eddf4-22bb-4afe-8158-ea795ea0c5c0)
2023-12-26 14:17:40 +00:00
shadcn
f60945c252 fix: add tailwind.prefix to schema (#2200)
* fix: add tailwind.prefix to schema

* fix(www): format
2023-12-26 18:00:26 +04:00
Rishabh
5eb33f7830 docs(pagination): wrong import path of components in pagination usage (#2180)
This PR:

Fixes: #2150
2023-12-26 13:35:19 +00:00
Rishabh
f6fef4a2ed docs(drawer): missing drawer footer import in drawer usage example (#2169)
This PR:

- Fixes:  #2168
2023-12-24 05:47:02 +00:00
arshad
f6f64ce773 Update: Rename 'ResizableGroup' to 'ResizablePanelGroup' in Documentation (#2166)
### Overview
This pull request updates the documentation to reflect the correct component name, changing `ResizableGroup` to `ResizablePanelGroup`. This change ensures consistency and correctness in the documentation, aiding developers in correctly implementing the component.

### Changes Made
- In the code examples within the documentation, `ResizableGroup` has been renamed to `ResizablePanelGroup`.
- This change is applied to both horizontal and vertical orientation examples.

### Additional Information
- These changes are confined to documentation and do not alter the actual implementation or functionality of the components in question.

Please review the changes for accuracy and merge if appropriate. Thanks!
2023-12-24 05:40:05 +00:00
Nader Ferjani
7ce4414445 docs: typo in drawer (#2164)
Co-authored-by: shadcn <m@shadcn.com>
2023-12-24 09:35:26 +04:00
shadcn
319c7c55cc fix(www): mail icon size (#2173) 2023-12-24 09:32:46 +04:00
shadcn
57d404b5d3 feat: new components (#2144) 2023-12-22 23:36:59 +04:00
github-actions[bot]
6145dd8118 chore(release): version packages (#1756)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-22 21:05:24 +04:00
Bereket Engida
4fb98d520f feat(cli): add support for custom Tailwind prefix transformer (#770)
* feat(cli): add support for custom Tailwind prefix

* fix(cli): add tw prefix on classes applied in the css file

* feat(cli): add support for custom tailwind prefix

* chore: add changeset

* style(shadcn-ui): code format

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-12-22 01:42:40 +04:00
ocavue
1cf5fad881 fix(toast): replace MAX_VALUE with MAX_SAFE_INTEGER (#1982)
This PR replaces the maximum id from `Number.MAX_VALUE` to `Number.MAX_SAFE_INTEGER` in `use-toast.ts`. Considering how JS stores numbers, it's unsafe to plus one if the number is larger than `Number.MAX_SAFE_INTEGER`. Here is an example:

```js 
> let num

> num = Number.MAX_VALUE - 1
> num + 1 === num
true

> num = Number.MAX_SAFE_INTEGER - 1
> num + 1 === num
false
```
2023-11-21 12:13:44 +00:00
Js Park
6f3050248c docs(www): update installation of Astro (#1958)
- The latest version of Astro generates `tailwind.config.mjs` file instead of `tailwind.config.cjs`.
- The `index.astro` file is located in `/src/pages`.
2023-11-19 07:24:12 +00:00
Gravy59
1903eb94a8 fix(www): typo in metric cards (#1975) 2023-11-19 11:16:27 +04:00
Danilo Britto
9f3ae7746f docs(www): add indeterminate state checkboxes on all data table demos and code examples (#1959)
Co-authored-by: shadcn <m@shadcn.com>
2023-11-19 11:15:44 +04:00
Dimitri POSTOLOV
c579e9232c add missing return Update page.tsx (#1952) 2023-11-17 00:20:36 +04:00
兰天游
08018ed623 feat: fix for column grouping (#945) 2023-11-12 19:12:40 +00:00
Max Wiseman
1db90baaf2 feat(toggle-group): add toggle-group component (#1547)
* feat: added toggle-group component

* fix(components): ran build:registry script

* fix(components): fixed colors in toggle-group
- Dark mode border color is now consistent with the toggle component

* fix(components): fixed component.json toggle-group
- Added the content field to `components.json` for toggle-group
- Ran build:registry again

* feat(toggle-group): simplify implementation

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-11-12 23:03:14 +04:00
shadcn
3dc6207e97 chore: build registry 2023-11-12 22:13:40 +04:00
Yahor Barkouski
5d2373fb7a fix(www): update faker version, reduce int() deprecation (#1832)
* fix: update faker version, reduce int() deprecation

* chore: pnpm format:write

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-11-12 22:12:58 +04:00
Peeranat Danaidusadeekul
e67c0d4507 style(command): add import type for Command component (#1490)
* style: add import type for Command component

* style(code): format code

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-11-12 22:12:16 +04:00
Mubin Ansari
147206c168 Remove Redundant md:w-full class in DialogPrimitive.Content in dialog and alert-dialog (#1640)
closes #1639
2023-11-12 11:09:14 +00:00
Thomas Alberola
e6e9a6772b Move className overwrite of AccordionContent to the children component (#1670)
In order to have a smooth opening of the accordion, moving the `AccordionContent` `className` overwrite to the children wrapper component allow Radix to calculate correctly the animation and execute a smooth animation in case of `className` on the `AccordionContent` component.

Possibly related to https://github.com/shadcn-ui/ui/issues/944
2023-11-12 10:56:52 +00:00
Chongyi Zheng
1ae9ffcf58 chore: upgrade @radix-ui/react-select to 2.0.0 (#1688) 2023-11-12 10:32:03 +00:00
shadcn
8fad64a854 feat(select): add scroll up and down button 2023-11-12 14:25:35 +04:00
shadcn
7527ff490a Merge branch 'main' into main 2023-11-12 13:49:12 +04:00
Tanish Baansal
3a279a2766 refactor(calendar): updated css so date doesn't show up selected twice in DatePickerComponent (#1852)
React Day Picker also has a unique styling distinction that designates the `day_outside` dates as unselected, and the selection of `day_outside` only highlights the dates in the next month. This PR will fix this issue - https://github.com/shadcn-ui/ui/issues/1762 and help with a cleaner UX 

  
<br/>

| Old Date Range Picker  | New Date Range Picker           |
| ---------------------- | ---------------------- |
| ![old](https://github.com/shadcn-ui/ui/assets/7449806/42e9448f-9e38-486c-b65c-cf00ec1ec7c7) | ![new](https://github.com/shadcn-ui/ui/assets/7449806/804f83d7-1b74-474c-8992-2d6d844dfb35) |

<br/>

#### React Day Picker
<img width="444" alt="image" src="https://github.com/shadcn-ui/ui/assets/7449806/aaeae160-b38c-4c16-bb2d-66898cf290d3">
2023-11-12 09:36:12 +00:00
Gravy59
51c8c3d798 fix(#1686): remove redundant children prop (#1717)
This pull request resolves #1686.

## Rationale for this PR

This PR affects the code for `RadioGroupItem` in both styles by removing the `children` prop from the component. The children prop is automatically passed in by the use of the spread operator (`...props`) and is redundant because it is never used in the component.

This PR shouldn't affect tests, representation, etc. and is merely a cosmetic change. There is no urgent need to merge this.
2023-11-12 09:28:07 +00:00
William Frank Monroy Mamani
53f211b043 docs: updated contributing guidelines to easily contribute (#1830)
## Explanation
Added detailed info to clone and setup the project to contribute.

Following the PR #1650 and suggestion of @shadcn.  Thanks!
2023-11-12 07:57:25 +00:00
Shubhdeep Chhabra
a2ed2883ac fix(alert-dialog): removed unused children prop (#1828) 2023-11-12 11:46:21 +04:00
Greg
66c7f6d73b fix(scroll-area): horizontal scroll bar not visible (#1829)
PRs #1515 and #1296 interfere with each other and cause the horizontal scroll bar to not be visible. This removes the conditional `flex-1`, however you could also remove `flex-col` to achieve the same result.

before:

https://github.com/shadcn-ui/ui/assets/9381099/6514de2e-e353-4d0b-bd24-aff79e0d5161

after:


https://github.com/shadcn-ui/ui/assets/9381099/3205baad-569b-4096-8dcd-9beb794de536
2023-11-12 07:36:35 +00:00
shadcn
fc3d8288f7 ci: update tasks name to make debug easier (#1932) 2023-11-12 11:30:00 +04:00
shadcn
6e399abdb4 fix(table): update style for table footer (#1931)
* fix(table): update table footer style

* chore: run registry

* style: fix docs
2023-11-12 11:20:18 +04:00
Martini
3c22784a98 docs(www): Fix typo (#1853) 2023-11-12 10:18:34 +04:00
Cole Cline
c82a6fab5f docs(www): Missing import statement (#1877)
Added missing import statement in fonts example in Next.js installation docs
2023-11-12 10:17:56 +04:00
Innei
3fccfeb301 fix(switch): change width unit to rem (#1891)
Signed-off-by: Innei <i@innei.in>
Co-authored-by: shadcn <m@shadcn.com>
2023-11-12 10:17:07 +04:00
Kevin Mok
42e8eaf7cb docs(www): add remix dark mode docs (#1920)
* docs(www): add remix dark mode docs

* docs(www): add modification to tailwindcss file
2023-11-12 10:16:22 +04:00
Michael Stramel
d250109cc4 fix(www): destructive contrast increase (#1899) 2023-11-06 18:30:44 +04:00
iaingymware
ef73e591c8 Merge branch 'main' into main 2023-10-24 19:50:21 +01:00
miquelvir
c6917799ce docs(card): remove unused line #1652 (#1798)
Fixes #1652
2023-10-24 12:27:21 +00:00
iaingymware
b4efc8aa4d Merge branch 'main' into main 2023-10-24 12:15:43 +01:00
miquelvir
35f776d38c Fix combobox examples using labels as value (#1788)
Fix #1785
2023-10-21 14:09:57 +00:00
Akshay Sharma
5cadc5e983 fix(www): update twitter icon to X (#1551)
* refactor(icon.tsx): twitter icon updated to latest version X icon

* refactor(icon.tsx): twitter icon updated to latest version X icon

* refactor(icons.tsx): added the same changes to the icon for X twitter icon

* refactor(icons.tsx): change the formating of the code

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-10-21 18:03:31 +04:00
Greg
e0782b328b docs(scroll-area): add example for horizontal scroll area (#1515)
Adds documentation to the `<ScrollArea>` component for creating a scroll area with a horizontal scrollbar. There is also a commit to fix the improper sizing of a horizontal scroll bars.

Before:
https://github.com/shadcn-ui/ui/assets/9381099/a8b512f1-37f7-4107-a9fa-42a26e124696

After:
https://github.com/shadcn-ui/ui/assets/9381099/480f881c-b0fe-4b1b-9472-c533135e6769
2023-10-21 13:54:16 +00:00
Bumsik Kim
cf0dadafce fix(example): Prevent hydration error in music example (#1569)
<DisalogTrigger> should have asChild when a button used.
2023-10-21 12:58:30 +00:00
/raj
5877dcd21a docs(www): bunx scripts run using bun instead of node (#1590)
* fix: using bun to initialize project works now

* style(www): format write

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-10-21 16:47:21 +04:00
Stefan Schulz
95be4835b1 fix(calendar): showOutsideDays=false (#1731)
showOutsideDays=false will shift the missing days of a month to the start of the row (cause of 'flex' in classnames: row), to fix it, we can use the same height and width in a cell as in a day

Co-authored-by: shadcn <m@shadcn.com>
2023-10-21 16:47:00 +04:00
Karan Janthe
5a13def46d fix: updated error msg for jsconfig in cli (#1696)
* fix: updated error msg for jsconfig in cli

* chore: add changeset

* style(cli): format

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-10-21 16:35:55 +04:00
kevinmitch14
b8810caac7 fix: remove invalid collapsible prop (#496)
only available when type="single"

Co-authored-by: shadcn <m@shadcn.com>
2023-10-21 16:28:00 +04:00
Peeranat Danaidusadeekul
24ec36ee7b docs: add missing tailwind config in Astro install (#1264)
* docs: add missing tailwind config in Astro install

* style: prettier format

---------

Co-authored-by: Peeranat Danaidusadeekul <ppeeranat.d@skooldio.com>
Co-authored-by: shadcn <m@shadcn.com>
2023-10-21 16:26:28 +04:00
onurhan
dd94aa936f fix(docs): present useForm when copy form (#1486)
When I tried it after the attached issue, I realized;
For someone who's absolutely copying and pasting form the guide, this would give an error, as useForm is not imported in the guide. So I fixed that.

Related issue: https://github.com/shadcn-ui/ui/issues/1482

Fix #1482
2023-10-21 12:16:22 +00:00
IDRISSI HAMZA
44f35d55b0 fix(components): fix text wrapping issue in buttons (#1548)
## What does this PR do?

This pull request resolves an issue where the button text wraps onto the next line in specific screen sizes when the text contains two or more words. By applying the whitespace-nowrap utility class to the button element, the text now remains on a single line, even on screens with limited space. This enhancement ensures a consistent and visually pleasing user experience across various devices :

### Before (Get Started Button)
![before](https://github.com/shadcn-ui/ui/assets/97639117/50c8211d-2ed7-46d0-8ab2-d4c565d0d6f3)


### After  (Get Started Button)
![after](https://github.com/shadcn-ui/ui/assets/97639117/0f9f7e68-31e8-4011-a2ca-d7e59b3690ee)





This problem arises in other projects utilizing Shadcn, and this pull request addresses and resolves the issue, as demonstrated in the Cal.com project example:

### Before (Set Up Button)
![button-before](https://github.com/calcom/cal.com/assets/97639117/8f588a53-411a-4e9d-95df-76bd42d480d7)

### After  (Set Up Button)
![button-fixed](https://github.com/calcom/cal.com/assets/97639117/4c74e77a-a2cd-4b0c-87ee-a82dbefc23eb)
2023-10-21 12:09:10 +00:00
N8
958a0fdb18 docs: ✏️ Add defaultValues to input in form examples (#1610)
Fixes: https://github.com/shadcn-ui/ui/issues/1609
2023-10-21 11:57:26 +00:00
Lachlan Heywood
6b660033fb fix(components): remove className from dialog portals (#1606)
Fixes #1595, #1644

This PR changes the components that use the `DialogPortal` element to be aliases rather than components that pass a className prop.

The `DialogPortalProps` type from `@radix/react-dialog` recently had a patch update that probably should have been a minor or maybe a major update which is causing a few people to see the error `Property 'className' does not exist on type 'DialogPortalProps'`.

Since the `DialogPortal` component doesn't actually output any DOM elements, it never technically supported the `className` prop and the fact that it surfaced that prop was really a bug.

The `AlertDialog` and `Dialog` components were updated in #1603, but the `Sheet` component still references `className` which is resolved in this PR.
2023-10-21 11:56:31 +00:00
iaingymware
dac5a0bd2c Merge branch 'main' into main 2023-10-20 19:46:52 +01:00
Olle Månsson
648ddde3a2 Fix support rule in site-header.tsx (#1628)
Fixes https://github.com/shadcn-ui/ui/issues/1627 if that is desired.
2023-10-19 18:10:45 +00:00
Luka Hartwig
4ec8a67dab Support tailwind.config.ts (#1247)
Fixes #659
Fixes #633

Create Next App is using `tailwind.config.ts` in the TypeScript template. Since this is a very common use case it would be nice to preserve the type safety of the file.

I added new templates for TypeScript files. I see there is an issue #1073 which asks for ESM support as well. This is not included in this PR.

I also fixed the type error in the keyframes that is also handled in #636
2023-10-19 17:44:11 +00:00
CamTheGoblin
9091dcdc1b docs(install): Clarify & Match tsconfig Edits (#1642)
This is a small update to the installation instructions for some of the frameworks to make the instructions on editing the tsconfig file consistant across the frameworks, and remove some potentially confusing wording (if people read too fast...like me). 

Mainly applying the gatsby tsconfig instructions to vite and astro, as it is the most clear. 
Additionally changed the wording from:
```
 Add the code below to the compilerOptions...
```
to:
```
Add the following code to the compilerOptions...
```
to avoid people easily misreading it as "add the code **below the** compilerOptions".
2023-10-19 17:27:01 +00:00
Josiah Hawkins
33f89e9654 docs: remove unused imports (#1661)
- Remove unused import from Alert Default example
- Remove unused imports from Alert Destructive example
- Remove unused imports from Dropdown Menu Radio Group example
2023-10-19 17:20:34 +00:00
shadcn
545423c93b chore: add kodiak 2023-10-19 21:12:17 +04:00
shadcn
82528a62a0 Merge branch 'main' into main 2023-10-18 21:37:12 +04:00
Deveesh Shetty
14abbd94b5 fix(www): removes redundant class-name from H2 component (#1703)
* chore: removes redundant class from typography-h2

* chore: remove class from new york style

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-10-18 21:33:24 +04:00
iaingymware
cf54b6fa71 Merge branch 'main' into main 2023-10-16 10:20:47 +01:00
Caíque de Castro Soares da Silva
46f247c47f style(shadcn-ui): use space instead of tab on config fixture (#1707)
* style: use space instead of tab on config fixture

* style: fix identation on template script

* chore(shadcn-ui): add changeset

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-10-16 13:16:55 +04:00
iaingymware
beb0281ca2 Merge branch 'main' into main 2023-10-16 10:15:44 +01:00
Iain Wandless
a54ade1b98 Merge branch 'main' of https://github.com/iaingymware/ui 2023-10-16 10:09:31 +01:00
Iain Wandless
11c1bc2cb9 feat(select): update newyork to use radix icons 2023-10-16 10:09:24 +01:00
Robert Soriano
4083876e80 docs: update Remix config to use ESM (#1710)
* docs(remix): replace postcss config sample to use export default

* docs(remix): replace tailwind config sample to use export default

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-10-16 12:56:08 +04:00
alex
0176754ff2 docs(www): add astro dark mode implementation (#1755)
* docs(www): add astro dark mode implementation

* docs(www): reduce redundancy in mode toggle
2023-10-16 12:37:25 +04:00
iaingymware
1be434bc64 Merge branch 'main' into main 2023-10-15 21:12:50 +01:00
shadcn
2a346ede51 feat(www): add custom close button example (#1753) 2023-10-15 16:28:57 +04:00
shadcn
82c56f9503 docs(www): add fonts docs (#1752) 2023-10-15 15:37:25 +04:00
Iain Wandless
f68798e50b Revert "feat(select): update registry"
This reverts commit b37fc17f04.
2023-10-10 14:15:08 +01:00
Iain Wandless
b37fc17f04 feat(select): update registry 2023-10-10 14:11:32 +01:00
Iain Wandless
d6063c5769 feat(select): scrollable with large datasets
newyork ui
2023-10-10 14:09:32 +01:00
Iain Wandless
ef9fa600a5 feat(select): scrollable with large datasets
update to default ui
2023-10-10 14:01:43 +01:00
shadcn
43c4023ed8 chore: rebuild registry 2023-10-03 18:47:47 +04:00
github-actions[bot]
c765635e13 chore(release): version packages (#1663)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-10-03 18:39:32 +04:00
shadcn
95a9673b1e minify cli (#1662)
* chore(shadcn-ui): minify build

* chore: add changeset
2023-10-03 18:20:58 +04:00
Oguz Kazkayasi
617cdd0e77 docs(www): framework is changed to language at language search example (#1646)
Co-authored-by: shadcn <m@shadcn.com>
2023-10-03 17:38:10 +04:00
shadcn
1536b7824e feat: export portal and overlay for alert-dialog, dialog and sheet (#1660) 2023-10-03 17:12:40 +04:00
Rohid
524e4b8b95 fix(alert-dialog): update portal component (#1603) 2023-10-03 17:02:31 +04:00
Diego Franchina
1f16cf4728 fix(scroll-area): added conditional flex-1 (#1296) 2023-09-25 15:29:05 +04:00
Rohan Godha
4f8d768e59 docs(www): add bun support for installation commands (#1445)
* feat(www): add bun support for commands

* chore: remove changeset

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-09-21 17:30:29 +04:00
Shoaib Ahmed
c0deeac0d0 fix(table): add relative class to handle overflow issue (#1370) 2023-09-19 19:17:38 +04:00
github-actions[bot]
897376329b chore(release): version packages (#1556)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-19 17:14:39 +04:00
shadcn
d3d52fc687 docs(cli): update link to documentation (#1555)
* docs(cli): update link to documentation

* chore: add changeset
2023-09-19 16:52:45 +04:00
shadcn
4d0864a5c2 Merge branch 'main' of github.com:shadcn/ui 2023-09-19 16:36:06 +04:00
shadcn
e8f58932bd chore: update repo for changeset 2023-09-19 16:35:50 +04:00
shadcn
2f0dbca221 feat(cli): do not ask for confirmation (#1554)
* feat(cli): do not confirm

* chore: add changeset
2023-09-19 16:25:57 +04:00
Paul Ebose
58d012e342 feat(cli): add overwrite confirmation for existing components (#973)
* feat(cli):  add overwrite confirmation for existing components

* fix(cli): handle overwrite for multiple items

* chore: add changeset

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-09-19 15:57:19 +04:00
Shishir
963114e118 feat(cli): support adding all components via CLI (#1033)
* feat: support adding all components via CLI

`shadcn-ui add --all`

This was manually tested to work as expected.

* chore: run prettier

* fix(cli): rename to all

* chore: add changeset

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-09-19 07:37:35 +04:00
Ayhan
0a4286500e fix(cli): handle ts file extension (#1466)
Co-authored-by: shadcn <m@shadcn.com>
2023-09-19 07:23:07 +04:00
Santi Dalmasso
ae845788f6 fix(cli): deduplicate classNames in applyColorMapping (#1089)
* fix(cli): deduplicate classNames in applyColorMapping

* refactor: simplify applyColorMapping return

* chore: add changeset

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-09-19 07:04:57 +04:00
oasisy
ccb2d695a7 fix(www): enable input editing in the dialog demo (#1428)
Co-authored-by: shadcn <m@shadcn.com>
2023-09-18 17:35:27 +04:00
Abderrahim Guerfi
b838ffe8cc docs(www): add missing prop to ThemeProvider (#1447)
Co-authored-by: shadcn <m@shadcn.com>
2023-09-18 16:47:58 +04:00
Robert Soriano
7ce6c495bd fix(www): rename DataTableFacetedFilter interface (#1438)
Co-authored-by: shadcn <m@shadcn.com>
2023-09-18 16:31:21 +04:00
MD
c9ca64d2b9 docs(www): update manual.mdx (#1471)
Fix file name

Co-authored-by: shadcn <m@shadcn.com>
2023-09-18 16:25:26 +04:00
Arjun Raj
4bb9e9de53 docs(www): update cli add options (#1484) 2023-09-18 16:23:47 +04:00
Nikhar Pandya
c21ecfb665 docs(www): update contrubuting.md and next.mdx (#1343)
* docs: Update CONTRIBUTING.md

added commit convention section to the contribution docs.

* docs: Update next.mdx for dark mode

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-08-31 17:01:36 +04:00
sanka
613ec3583f docs(www): update dark-mode for vite (#1118)
Co-authored-by: sanka <sanka.s@fidenz.com>
Co-authored-by: shadcn <m@shadcn.com>
2023-08-26 14:45:34 +04:00
Diego Franchina
170d3c087c fix(scroll-area): missing key prop error (#1295)
Co-authored-by: shadcn <m@shadcn.com>
2023-08-25 07:24:04 +04:00
kevinmitch14
4b0fbe27fa fix(www): don't allow empty chat messages (#1137)
Co-authored-by: shadcn <m@shadcn.com>
2023-08-25 06:51:19 +04:00
rcrosbourne
c34193cd34 docs(www): add Laravel install docs (#1279)
Co-authored-by: shadcn <m@shadcn.com>
2023-08-24 20:01:29 +04:00
Deveesh Shetty
88fdc989e9 chore(www): remove unneccesary imports (#1311)
* chore: remove uneccesary imports

* chore: remove from new-york style

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-08-24 09:26:12 +04:00
K-Sato
4506822389 chore: remove a duplicate call in init.test (#1319)
* chore: remove duplicate call in init.test

* chore: add changeset

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-08-24 09:14:20 +04:00
jspark
33a5fc7966 docs(www): fix typo (#1270) 2023-08-17 21:39:49 +04:00
Dani
33b77e2f31 fix(toast): toast add missing text color class (#1162)
Co-authored-by: shadcn <m@shadcn.com>
2023-08-17 15:27:23 +04:00
shadcn
e3769277d8 docs: update CONTRIBUTING.md 2023-08-17 15:00:08 +04:00
shadcn
3992a7b19c docs: add contributing guide (#1266) 2023-08-17 14:59:22 +04:00
shadcn
52c23746bc fix(www): issue with border radius in component preview (#1265) 2023-08-17 14:14:48 +04:00
vinay
f68976b667 docs(www): remove unused Link import in form docs. (#1251)
Co-authored-by: shadcn <m@shadcn.com>
2023-08-17 13:50:34 +04:00
Edgaras Benediktavicius
7a1f80af2c docs(www): @hookform/resolvers installation missing (#1257)
Co-authored-by: shadcn <m@shadcn.com>
2023-08-17 13:43:32 +04:00
我不是张硕
646f715388 fix(www): error in color values for slaet (#1224)
Co-authored-by: shadcn <m@shadcn.com>
2023-08-17 13:35:06 +04:00
Alonso Ureña
9441130f05 fix(www): payment method :has selector not working on Firefox (#1209)
Co-authored-by: shadcn <m@shadcn.com>
2023-08-16 21:11:49 +04:00
Daniele Luisetto
48e3a4a326 fix(docs): add missing files in toast manual installation (#1243)
Co-authored-by: shadcn <m@shadcn.com>
2023-08-16 07:32:09 +04:00
Daniele Luisetto
98078fbe01 fix(docs): missing form manual installation and aspect-ratio typo (#1242)
* fix(docs): add form manual installation

* fix(docs): typo in aspect-ratio

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-08-16 07:26:49 +04:00
shadcn
8be9e5d966 fix(www): extra semi 2023-08-15 19:25:11 +04:00
Nguyen Long Nhat
a8b1ea7e55 fix: remove semicolon duplicated in theme.css (#1146) 2023-08-15 19:24:37 +04:00
shadcn
3c9f7ca0e2 feat: themes (#1135) 2023-08-07 22:39:16 +04:00
shadcn
c598f19845 docs(www): fix typo 2023-08-04 20:54:46 +04:00
Paul Ebose
7962cee384 docs(www): add api reference for components.json (#982)
* docs: add api reference for component.json file

* docs: use Link for internal links in component.json

* docs(www): update docs for components.json

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-08-04 17:03:41 +04:00
Guten Ye
de3c34845b docs(www): update import in remix installation (#974)
Co-authored-by: shadcn <m@shadcn.com>
2023-08-03 22:27:39 +04:00
vinay
6a1354e52d fix(examples): update keyboard shortcut for opening dialog on Windows (#1004) 2023-08-03 22:22:38 +04:00
Rudy Orre
1532a15894 docs(www): add missing "command" component to imports (#550)
Co-authored-by: shadcn <m@shadcn.com>
2023-08-03 21:57:39 +04:00
Alan Daniel
8e5d080900 docs(www): add dark mode for Vite. (#814)
Co-authored-by: shadcn <m@shadcn.com>
2023-08-03 19:41:33 +04:00
GrungeElFz
cf95943446 docs(www): update import path for button (#839)
Co-authored-by: shadcn <m@shadcn.com>
2023-08-03 19:03:44 +04:00
vinay
3210bed755 fix(next-template): remove experimental appdir (#979)
Co-authored-by: shadcn <m@shadcn.com>
2023-08-01 19:21:18 +04:00
Bernardo Ferrari
eaa91d43df style(card): remove extra spacing (#1082) 2023-08-01 19:07:03 +04:00
Antsiferov Maxim
8cf0c7f3ba fix(alert): padding on Firefox (#1059)
Co-authored-by: shadcn <m@shadcn.com>
2023-07-30 15:50:11 +04:00
Abdulelah
da7729644c fix(combobox): search language by label in examples (#989)
Co-authored-by: shadcn <m@shadcn.com>
2023-07-30 15:33:18 +04:00
shadcn
aca3ef97e3 fix(www): responsive cards (#1066) 2023-07-28 23:14:38 +04:00
Deveesh Shetty
c9fecd4cdf fix(www): overflow issue in documentation (#1055)
Co-authored-by: shadcn <m@shadcn.com>
2023-07-28 16:03:43 +04:00
munan56
6cf598d47f docs(www): update import path next.mdx (#1062) 2023-07-28 15:56:19 +04:00
shadcn
91727ec460 ci: rename repo owner (#1056) 2023-07-27 13:12:13 +04:00
Pedro Vítor Ribeiro Martins
5e172fc34f docs(www): add typescript configuration question to cli docs (#898)
Co-authored-by: shadcn <m@shadcn.com>
2023-07-12 20:34:05 +04:00
Drew Greene
f461ab0910 docs(www): update label in card demo (#799)
Co-authored-by: shadcn <m@shadcn.com>
2023-07-12 20:22:35 +04:00
Lennart Gastler
26c8d0f662 docs(www): improve astro guide (#858) 2023-07-12 20:17:25 +04:00
vinay
ac5c727fc9 docs(www): add links to frameworks (#744)
Co-authored-by: shadcn <m@shadcn.com>
2023-07-05 23:29:14 +04:00
shadcn
54b1f5b661 feat: update next-template 2023-07-05 23:00:03 +04:00
github-actions[bot]
25a41cfe2a chore(release): version packages (#835)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-04 23:26:32 +04:00
shadcn
edc653c01e feat(shadcn-ui): add support for jsx (#834) 2023-07-04 23:22:20 +04:00
shadcn
f78a4aaa28 chore(www): site updates (#829)
* chore(www): update to latest Next.js

* feat(www): replace lucide icons
2023-07-04 17:04:22 +04:00
shadcn
b4dda36cc9 docs(www): add radix-ui deps install (#827) 2023-07-04 12:01:50 +04:00
Lennart
cbe0f1959c docs(www): improve Gatsby guide (#826) 2023-07-04 10:55:01 +04:00
Daniele Luisetto
dbd3b8f066 docs(www): add astro installation guide (#824) 2023-07-04 10:02:34 +04:00
Moinul Moin
7abb4019c3 docs(www): add installation guide for Gatsby (#822)
* docs: add installation guide for Gatsby

* docs: add  PR review changes
2023-07-03 22:23:52 +04:00
shadcn
b14081631f docs(www): fix link 2023-06-30 23:32:17 +04:00
github-actions[bot]
0857bfe889 chore(release): version packages (#737)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-30 22:56:01 +04:00
shadcn
ea6699adbf feat: restructure installation docs 2023-06-30 22:37:43 +04:00
Samuel Adebayo
1f004243d4 docs(www): add react with vite installation guide (#714)
* docs: add react with vite installation guide

* refactor(docs): move Ract with vite page into installation.mdx as tab

* fix(docs): remove classnames and wrapper divs

* fix(docs): update tsconfig file path to default @

* docs(www): fix code style

---------

Co-authored-by: Samuel Adebayo <samuel.adebayo@engagetech.com>
Co-authored-by: shadcn <m@shadcn.com>
2023-06-30 21:21:10 +04:00
Christoffer Hallas
eee7ce6879 docs(www): add remix and tabbed installation docs (#753)
* docs: add react with vite installation guide

* refactor(docs): move Ract with vite page into installation.mdx as tab

* fix(docs): remove classnames and wrapper divs

* fix(docs): update tsconfig file path to default @

* feat: added remix installation docs

* feat: added tabbed installation docs

* fix: remove log statement

* fix: cleaned up, restored usage notice, removed vite for now

* fix: moved installation.mdx into folder

---------

Co-authored-by: Samuel Adebayo <samuel.adebayo@engagetech.com>
Co-authored-by: shadcn <m@shadcn.com>
2023-06-29 17:27:03 +04:00
Mark Lyck
c3377530f4 feat(shadcn-cli): add support for bun install (#707)
* add support for bun install

* fix(cli): add changeset for bun install

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-06-27 11:48:51 +04:00
Fady Makram
a8bb2ef737 fix(accordion): prevent accordion chevron from shrinking on smaller viewports (#717)
* Prevent accordion chevron from shrinking on smaller viewports

* fix: apply feedback
2023-06-27 11:39:54 +04:00
sean-brydon
ab836d1ab3 fix(www): update data-table-toolbar to correctly handle isFiltered (#702)
* Update data-table-toolbar.tsx

* style(www): run format:write

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-06-26 16:16:03 +04:00
Daichi Ninomiya
77d6f5676e chore(www): pnpx to pnpm dlx (#350)
* fix(npm-commands): pnpx to pnpm dlx

* style(www): fix

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-06-26 15:50:53 +04:00
github-actions[bot]
2846b2ea9a chore(release): version packages (#696)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-24 21:12:15 +04:00
Samuel Corsi-House
0f84973b4d fix(shadcn-ui): use @antfu/ni to detect package manager (#677)
* fix(cli): use @antfu/ni to detect package manager

* chore(cli): cleanup imports

* Create cyan-houses-dress.md

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-06-24 21:01:22 +04:00
Caio Borghi
f8348621f4 docs(www): fix TypeScript typo (#645)
Co-authored-by: shadcn <m@shadcn.com>
2023-06-24 20:38:10 +04:00
Daniele Luisetto
fbed50f4e8 fix(shadcn-ui): cssVars template typo causing missing value (#682)
Co-authored-by: shadcn <m@shadcn.com>
2023-06-24 20:10:01 +04:00
Daniele Luisetto
1971fa7511 fix(shadcn-ui): use slash for alpha values in colors (#681)
Co-authored-by: shadcn <m@shadcn.com>
2023-06-24 20:09:22 +04:00
Daniele Luisetto
7b5582e5d0 fix(docs): remove duplicate install command (#679)
Co-authored-by: shadcn <m@shadcn.com>
2023-06-24 15:51:23 +04:00
Bryce Kalow
2ca7476c9b docs(www): directory -> directive (#685) 2023-06-24 15:49:47 +04:00
Reda
aea12e9762 docs(www): missing RSC anchor link (#664)
adda a missing # for the RSC section anchor link, resulting in 404.

Co-authored-by: shadcn <m@shadcn.com>
2023-06-23 20:08:18 +04:00
shadcn
343acb3a51 docs: update toast.mdx (#670) 2023-06-23 19:13:29 +04:00
shadcn
cf139e5fa1 feat: add manual installation for components (#666) 2023-06-23 14:28:34 +04:00
Ahmed Abdelbaset
38fb9693d0 style(shadcn-ui): remove unused variable in index.ts (#654) 2023-06-23 10:58:33 +04:00
Amruth Pillai
f1de3401a2 fix: update schema.json (#651)
Co-authored-by: shadcn <m@shadcn.com>
2023-06-23 00:27:28 +04:00
shadcn
379d1560c3 docs: add latest to cli (#649) 2023-06-23 00:07:19 +04:00
github-actions[bot]
d604b82fb3 chore(release): version packages (#644)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-22 23:08:57 +04:00
shadcn
658c710bce fix: schema keys validation (#641)
* fix: schema keys validation

* chore: add changeset

* fix: update registry base url
2023-06-22 23:05:54 +04:00
github-actions[bot]
4ca9619efa chore(release): version packages (#640)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-22 22:49:27 +04:00
shadcn
eeb17545a1 feat: new CLI, Styles and more (#637) 2023-06-22 22:44:52 +04:00
Tat Tran
3d717f992b fix: class name typo (#398)
* fix: class name

* fix: class names order

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-05-29 11:26:44 +04:00
moshyfawn
042554ad07 fix(www): register field array input once (#466)
Closes: #465

Co-authored-by: shadcn <m@shadcn.com>
2023-05-29 11:20:43 +04:00
Hajime Nakagawa
71f496d41f fix(command): modify incorrect className (#473)
text-foreground-muted => text-muted-foreground

Co-authored-by: shadcn <m@shadcn.com>
2023-05-29 11:16:04 +04:00
puneet-sarhali
0a5df3ac85 docs(www): broken link to React Hook Form's useController hook (#479)
Co-authored-by: shadcn <m@shadcn.com>
2023-05-29 11:10:34 +04:00
shadcn
eb27529f50 feat(next-template): update template and dependencies (#483)
* feat(next-template): update template and deps

* docs(next-template): update README

* fix(www): update deps

* chore: remove console.log
2023-05-29 11:02:02 +04:00
Prince Hernandez
dffbe89f7d feat(cli): add support for config file (#245)
* feat(cli): add config files and examples in docs

* docs(www): remove cli advanced options

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-05-28 10:21:11 +04:00
Alexander Kachkaev
22f23b7db3 chore: update pnpm version in package.json (#314)
* Update pnpm version in package.json

* Update package.json

* 8.5.1

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-05-25 22:05:55 +04:00
Brad Adams
d6d4017b95 fix: tailwind-indicator classnames (#453)
+ Remove unnecessary `hidden` breakpoint classnames

Co-authored-by: shadcn <m@shadcn.com>
2023-05-25 21:05:41 +04:00
Sammy Hass
00ecdfbb17 fix(docs): command menu unresponsive after no results (#455) 2023-05-25 20:57:49 +04:00
Oliver Schneider
065ba02ae5 feat(sheet): expose close trigger for Sheet (#438)
Co-authored-by: shadcn <m@shadcn.com>
2023-05-25 16:10:22 +04:00
Spastic
5dfc2020aa fix typings (#287)
* fix typings

* change Toast interface to type

* ran prettier
2023-05-25 15:51:13 +04:00
Daniel Rotärmel
5aecccc586 feat(cli): use https_proxy and consider previous install locations (#430)
* feat(cli): use system proxy

* feat(cli): adds default installation directory

* style: formatting

* feat: update lockfile

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-05-25 14:37:37 +04:00
shadcn
97a444b210 feat(www): add link to view code examples 2023-05-25 13:32:05 +04:00
Raí Siqueira
060e896183 fix(www): fix language placeholder (#433)
Signed-off-by: Rai Siqueira <rai93siqueira@gmail.com>
2023-05-24 18:21:27 +04:00
Dev
c4da22ffe9 docs(www): Fix unmatched closing brace typo (#423)
Co-authored-by: shadcn <m@shadcn.com>
2023-05-23 11:31:32 +04:00
dong.huo
f6b2d0c5dd fix(www): add key to list map components (#413)
Co-authored-by: shadcn <m@shadcn.com>
2023-05-23 11:22:35 +04:00
Zwyx
3f01388389 docs(www): fix inconsistency in forms docs + add note about uncontrolled components (#417)
* fix(forms): correct inconsistency in forms example

* doc(forms): add note about uncontrolled components
2023-05-22 17:00:59 +04:00
shadcn
c584f01163 docs(www): update defaultValues for useForm 2023-05-22 13:43:29 +04:00
shadcn
588ebd79e4 fix(www): filter out disabled links 2023-05-20 21:44:26 +04:00
shadcn
36881682cf feat: switch to stable next 2023-05-20 20:02:42 +04:00
jeremy
d1363515eb fix: incorrect example in form docs (#387) 2023-05-20 12:13:06 +04:00
Usman S. (Max Programming)
5afb8d530f docs(www): fix typo (#375)
Co-authored-by: shadcn <m@shadcn.com>
2023-05-20 10:09:42 +04:00
Piros
6a5195498f fix(radio-group): add aspect-square on radio button (#379)
Co-authored-by: shadcn <m@shadcn.com>
2023-05-20 10:03:52 +04:00
Piros
7d8be94a01 docs(www): update react-hook-form.mdx (#378)
Co-authored-by: shadcn <m@shadcn.com>
2023-05-20 09:58:25 +04:00
moshyfawn
a3c904dcc9 fix(www): refactor controlled inputs API examples (#385)
* refactor: remove usage of uncontrolled input apis within controlled inputs

Closes: #384

* docs: display FormField controlled input usage example

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-05-20 08:58:44 +04:00
moshyfawn
11447c9bff fix(form): avoid unnecessary state subscriptions (#383)
* perf: avoid unnecessary state subscriptions

Closes: #382

* fix(form): code format

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-05-20 08:52:53 +04:00
moshyfawn
f9d399172c fix(www): display account form name input error (#381)
* docs: display account form name input error

Closes: #380

* style: remove callback return statement
2023-05-20 08:40:01 +04:00
shadcn
4ccff13f9c feat: react-hook-form (#377)
* feat(form): add form component

* feat(www): update site styles

* feat: add form examples

* docs(www): add docs for forms

* docs(www): hide tabs for docs demo
2023-05-19 22:56:49 +04:00
Quentin
dbbdbe618f fix(www): missing ']' in className (#358)
* fix(code-block-wrapper): missing ']' in className

* fix(code-block-wrapper): re-order tailwind className

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-05-16 15:41:35 +04:00
Yiyang
b09cff40ae fix(textarea): replace h-20 with min-h-[80px] (#344)
Co-authored-by: shadcn <m@shadcn.com>
2023-05-16 15:04:17 +04:00
github-actions[bot]
df9369762a chore(release): version packages (#352)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-13 13:35:46 +04:00
Nirmalya Ghosh
87ad14cb2a fix(shadcn-ui): add missing deps for Button (#259)
* fix: add missing deps for Button

* fix: use correct dep

Co-authored-by: Pablo <its.monotype@gmail.com>

* chore: add changeset

---------

Co-authored-by: Pablo <its.monotype@gmail.com>
Co-authored-by: shadcn <m@shadcn.com>
2023-05-13 13:07:39 +04:00
Jack
5a2ce61e2e fix(data-table): uncontrolled input error on data-table (#335) 2023-05-11 10:07:39 +04:00
Bilal Afzal
4a7c07e754 fix(next-template): remove unused import Laptop in icons.tsx (#310)
Remove unused import 'Laptop' in icons.tsx (nextjs-example)

Co-authored-by: shadcn <m@shadcn.com>
2023-05-10 21:48:46 +04:00
shadcn
8eb3e1e160 fix(www): update padding for row actions 2023-05-10 20:51:00 +04:00
shadcn
5bc68894b8 fix(www): filter display for lg 2023-05-10 16:32:57 +04:00
Connor Stevens
21890afa80 docs(www): fix typo
Co-authored-by: shadcn <m@shadcn.com>
2023-05-10 07:49:17 +04:00
Ben Jacobson
84b7200178 docs(www): fix link to DataTable (#322) 2023-05-10 00:09:15 +04:00
shadcn
f8272baf07 feat: add table and data table (#321) 2023-05-09 23:25:26 +04:00
Mike Robinson
9a6b934421 feat(table): add table component (#248)
* Add table.tsx

* Update table.tsx

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-05-08 15:49:19 +04:00
Mike Robinson
b3247d90a6 fix(checkbox,radio-group): Increase contrast ratio of checkboxes and radio buttons (#224)
* Update checkbox.tsx

* Update radio-group.tsx

* fix(radio-group): update colors for contrast

* fix(checkbox): update colors for contrast

---------

Co-authored-by: shadcn <m@shadcn.com>
2023-05-08 15:43:10 +04:00
Danazumi
0c31f60bb0 fix(next-template): strict type check
Co-authored-by: Danazumi <granzin98@gmail.com>
Co-authored-by: shadcn <m@shadcn.com>
2023-05-03 18:47:49 +04:00
James
be64c55901 fix(dropdown-menu): dropdown sub menu using wrong text color (#285) 2023-05-03 17:20:18 +04:00
shadcn
b19199a35d docs: move combobox and date picker to their own page (#283) 2023-05-03 15:59:00 +04:00
shadcn
6e67107170 fix(www): update to canary with scrolling fix (#279) 2023-05-03 10:53:59 +04:00
3507 changed files with 270893 additions and 13738 deletions

View File

@@ -1,11 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "shadcn/ui" }],
"changelog": ["@changesets/changelog-github", { "repo": "shadcn-ui/ui" }],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["www", "**-template"]
"ignore": ["www", "v4"]
}

View File

@@ -0,0 +1,5 @@
---
"shadcn": minor
---
add theme vars support

View File

@@ -0,0 +1,5 @@
---
"shadcn": minor
---
add tailwind version detection

View File

@@ -0,0 +1,5 @@
---
"shadcn": minor
---
add support for tailwind v4

View File

@@ -0,0 +1,5 @@
---
"shadcn": minor
---
default for new-york for v4

View File

@@ -0,0 +1,5 @@
---
"shadcn": minor
---
fix handling of sidebar colors

View File

@@ -0,0 +1,5 @@
---
"shadcn": minor
---
hotswap style for v4

View File

@@ -0,0 +1,5 @@
---
"shadcn": minor
---
add warning for deprecated components

8
.eslintignore Normal file
View File

@@ -0,0 +1,8 @@
node_modules/
target/
.next/
build/
dist/
/templates/
/fixtures/

View File

@@ -8,15 +8,15 @@
"plugin:tailwindcss/recommended"
],
"plugins": ["tailwindcss"],
"ignorePatterns": ["**/fixtures/**"],
"rules": {
"@next/next/no-html-link-for-pages": "off",
"react/jsx-key": "off",
"tailwindcss/no-custom-classname": "off",
"tailwindcss/classnames-order": "error"
},
"settings": {
"tailwindcss": {
"callees": ["cn"],
"callees": ["cn", "cva"],
"config": "tailwind.config.cjs"
},
"next": {

View File

@@ -0,0 +1,25 @@
title: "[blocks]: "
labels: ["Blocks Request"]
body:
- type: markdown
attributes:
value: |
### Thanks for taking the time to create a block request! Please search open/closed requests before submitting, as the block or a similar one may have already been requested.
- type: textarea
id: block-description
attributes:
label: Description
description: Tell us about your block request
placeholder: "A dashboard for an e-commerce website showing sales, orders, and customers..."
validations:
required: true
- type: input
id: block-example-url
attributes:
label: Example
description: Link to an example of the block
placeholder: ex. https://example.com
validations:
required: false

85
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@@ -0,0 +1,85 @@
name: "Bug report"
description: Report an issue
title: '[bug]: '
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
### Thanks for taking the time to create a bug report. Please search open/closed issues before submitting, as the issue may have already been reported/addressed.
- type: markdown
attributes:
value: |
#### If you aren't sure this is a bug or not, please open a discussion instead:
- [Discussions](https://github.com/shadcn-ui/ui/discussions/new?category=general)
- type: textarea
id: bug-description
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us how in the description. Thanks!
placeholder: Bug description
validations:
required: true
- type: input
id: components-affected
attributes:
label: Affected component/components
description: Which shadcn/ui components are affected?
placeholder: ex. Button, Checkbox...
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: How to reproduce
description: A step-by-step description of how to reproduce the bug.
placeholder: |
1. Go to '...'
2. Click on '....'
3. See error
validations:
required: true
- type: input
id: codesandbox-stackblitz
attributes:
label: Codesandbox/StackBlitz link
description: |
A link to a CodeSandbox or StackBlitz that includes a minimal reproduction of the problem. In rare cases when not applicable, you can link to a GitHub repository that we can easily run to recreate the issue. If a report is vague and does not have a reproduction, it will be closed without warning.
> [!CAUTION]
> If you skip this step, this issue might be **labeled** with `please add a reproduction` and **closed**.
validations:
required: false
- type: textarea
id: logs
attributes:
label: Logs
description: "Please include browser console and server logs around the time this bug occurred. Optional if provided reproduction. Please try not to insert an image but copy paste the log text."
render: bash
- type: textarea
id: system-info
attributes:
label: System Info
description: Information about browsers, system or binaries that's relevant.
render: bash
placeholder: System, Binaries, Browsers
validations:
required: true
- type: checkboxes
id: terms
attributes:
label: Before submitting
description: By submitting this issue, you agree to follow our [Contributing Guidelines](https://github.com/shadcn-ui/ui/blob/main/CONTRIBUTING.md).
options:
- label: I've made research efforts and searched the documentation
required: true
- label: I've searched for existing issues
required: true

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Get Help
url: https://github.com/shadcn-ui/ui/discussions/new?category=general
about: If you can't get something to work the way you expect, open a question in our discussion forums.

View File

@@ -0,0 +1,55 @@
name: "Feature request"
description: Create a feature request for shadcn/ui
title: '[feat]: '
labels: ['area: request']
body:
- type: markdown
attributes:
value: |
### Thanks for taking the time to create a feature request! Please search open/closed issues before submitting, as the issue may have already been reported/addressed.
- type: markdown
attributes:
value: |
#### If you aren't sure this is a bug or not, please open a discussion instead:
- [Discussions](https://github.com/shadcn-ui/ui/discussions/new?category=general)
- type: textarea
id: feature-description
attributes:
label: Feature description
description: Tell us about your feature request
placeholder: 'I think this feature would be great because...'
value: 'Describe your feature request...'
validations:
required: true
- type: input
id: components-affected
attributes:
label: Affected component/components
description: Is this feature request relevant to any of the already existing components?
placeholder: ex. Button, Checkbox...
validations:
required: false
- type: textarea
id: context
attributes:
label: Additional Context
description: Add any other context about the feature here.
placeholder: ex. screenshots, Stack Overflow links, forum links, etc.
value: 'Additional details here...'
validations:
required: false
- type: checkboxes
id: terms
attributes:
label: Before submitting
description: By submitting this issue, you agree to follow our [Contributing Guidelines](https://github.com/shadcn-ui/ui/blob/main/CONTRIBUTING.md).
options:
- label: I've made research efforts and searched the documentation
required: true
- label: I've searched for existing issues and PRs
required: true

View File

@@ -4,7 +4,7 @@
import { exec } from "child_process"
import fs from "fs"
const pkgJsonPath = "packages/cli/package.json"
const pkgJsonPath = "packages/shadcn/package.json"
try {
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath))
exec("git rev-parse --short HEAD", (err, stdout) => {

View File

@@ -4,7 +4,7 @@
import { exec } from "child_process"
import fs from "fs"
const pkgJsonPath = "packages/cli/package.json"
const pkgJsonPath = "packages/shadcn/package.json"
try {
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath))
exec("git rev-parse --short HEAD", (err, stdout) => {

View File

@@ -7,7 +7,7 @@ on:
jobs:
lint:
runs-on: ubuntu-latest
name: Lint
name: pnpm lint
steps:
- uses: actions/checkout@v3
with:
@@ -16,12 +16,13 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- uses: pnpm/action-setup@v2.2.4
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 9.0.6
run_install: false
- name: Get pnpm store directory
@@ -42,7 +43,7 @@ jobs:
format:
runs-on: ubuntu-latest
name: Format
name: pnpm format:check
steps:
- uses: actions/checkout@v3
with:
@@ -51,12 +52,13 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- uses: pnpm/action-setup@v2.2.4
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 9.0.6
run_install: false
- name: Get pnpm store directory
@@ -79,7 +81,7 @@ jobs:
tsc:
runs-on: ubuntu-latest
name: TypeScript
name: pnpm typecheck
steps:
- uses: actions/checkout@v3
with:
@@ -88,12 +90,13 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- uses: pnpm/action-setup@v2.2.4
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 9.0.6
run_install: false
- name: Get pnpm store directory
@@ -110,4 +113,7 @@ jobs:
- name: Install dependencies
run: pnpm install
- name: Build packages
run: pnpm --filter=shadcn build
- run: pnpm typecheck

27
.github/workflows/issue-stale.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
# Adapted from vercel/next.js
name: Issue Stale
on:
workflow_dispatch:
schedule:
# This runs every day 20 minutes before midnight: https://crontab.guru/#40_23_*_*_*
- cron: "40 23 * * *"
jobs:
stale:
runs-on: ubuntu-latest
if: github.repository_owner == 'shadcn-ui'
steps:
- uses: actions/stale@v4
id: stale-no-repro
name: "Close stale issues with no reproduction"
with:
repo-token: ${{ secrets.STALE_TOKEN }}
close-issue-message: "This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please reopen or leave a comment. Thank you.\n(This is an automated message.)"
days-before-issue-close: 7
days-before-issue-stale: 30
stale-pr-label: "stale?"
days-before-pr-close: 7
days-before-pr-stale: 15
only-pr-labels: "postpone: more info or changes requested,please add a reproduction"
exempt-issue-labels: "roadmap,next,bug"
operations-per-run: 300 # 1 operation per 100 issues, the rest is to label/comment/close

View File

@@ -10,7 +10,7 @@ on:
jobs:
comment:
if: |
github.repository_owner == 'shadcn' &&
github.repository_owner == 'shadcn-ui' &&
${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
name: Write comment to the PR
@@ -28,8 +28,8 @@ jobs:
for (const artifact of allArtifacts.data.artifacts) {
// Extract the PR number and package version from the artifact name
const match = /^npm-package-shadcn-ui@(.*?)-pr-(\d+)/.exec(artifact.name);
const match = /^npm-package-shadcn@(.*?)-pr-(\d+)/.exec(artifact.name);
if (match) {
require("fs").appendFileSync(
process.env.GITHUB_ENV,
@@ -49,7 +49,7 @@ jobs:
A new prerelease is available for testing:
```sh
npx shadcn-ui@${{ env.BETA_PACKAGE_VERSION }}
pnpm dlx shadcn@${{ env.BETA_PACKAGE_VERSION }}
```
- name: "Remove the autorelease label once published"

View File

@@ -10,7 +10,7 @@ on:
jobs:
prerelease:
if: |
github.repository_owner == 'shadcn' &&
github.repository_owner == 'shadcn-ui' &&
contains(github.event.pull_request.labels.*.name, '🚀 autorelease')
name: Build & Publish a beta release to NPM
runs-on: ubuntu-latest
@@ -23,7 +23,9 @@ jobs:
fetch-depth: 0
- name: Use PNPM
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v4
with:
version: 9.0.6
- name: Use Node.js 18
uses: actions/setup-node@v3
@@ -38,7 +40,7 @@ jobs:
run: node .github/version-script-beta.js
- name: Authenticate to NPM
run: echo "//registry.npmjs.org/:_authToken=$NPM_ACCESS_TOKEN" >> packages/cli/.npmrc
run: echo "//registry.npmjs.org/:_authToken=$NPM_ACCESS_TOKEN" >> packages/shadcn/.npmrc
env:
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
@@ -49,10 +51,10 @@ jobs:
id: package-version
uses: martinbeentjes/npm-get-version-action@main
with:
path: packages/cli
path: packages/shadcn
- name: Upload packaged artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: npm-package-shadcn-ui@${{ steps.package-version.outputs.current-version }}-pr-${{ github.event.number }} # encode the PR number into the artifact name
path: packages/cli/dist/index.js
name: npm-package-shadcn@${{ steps.package-version.outputs.current-version }}-pr-${{ github.event.number }} # encode the PR number into the artifact name
path: packages/shadcn/dist/index.js

View File

@@ -9,7 +9,7 @@ on:
jobs:
release:
if: ${{ github.repository_owner == 'shadcn' }}
if: ${{ github.repository_owner == 'shadcn-ui' }}
name: Create a PR for release workflow
runs-on: ubuntu-latest
steps:
@@ -19,11 +19,14 @@ jobs:
fetch-depth: 0
- name: Use PNPM
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v4
with:
version: 9.0.6
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
version: 9.0.6
node-version: 18
cache: "pnpm"
@@ -34,7 +37,7 @@ jobs:
# run: pnpm check
- name: Build the package
run: pnpm build:cli
run: pnpm shadcn:build
- name: Create Version PR or Publish to NPM
id: changesets

42
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Test
on:
pull_request:
branches: ["*"]
jobs:
test:
runs-on: ubuntu-latest
name: pnpm test
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 9.0.6
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- run: pnpm test

7
.gitignore vendored
View File

@@ -33,4 +33,9 @@ yarn-error.log*
.turbo
.contentlayer
tsconfig.tsbuildinfo
tsconfig.tsbuildinfo
# ide
.idea
.fleet
.vscode

View File

@@ -1,4 +0,0 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx commitlint --edit $1

18
.kodiak.toml Normal file
View File

@@ -0,0 +1,18 @@
# .kodiak.toml
version = 1
[merge]
automerge_label = "automerge"
require_automerge_label = true
method = "squash"
delete_branch_on_merge = true
optimistic_updates = false
prioritize_ready_to_merge = true
notify_on_conflict = true
[merge.message]
title = "pull_request_title"
body = "pull_request_body"
include_pr_number = true
body_type = "markdown"
strip_html_comments = true

1
.npmrc
View File

@@ -1 +1,2 @@
auto-install-peers=true
link-workspace-packages=true

2
.nvmrc
View File

@@ -1 +1 @@
v16.18.0
v20.5.1

View File

@@ -3,4 +3,5 @@ node_modules
.next
build
.contentlayer
apps/www/pages/api/components.json
apps/www/pages/api/registry.json
**/fixtures

11
.vscode/settings.json vendored
View File

@@ -2,5 +2,16 @@
"eslint.workingDirectories": [
{ "pattern": "apps/*/" },
{ "pattern": "packages/*/" }
],
"tailwindCSS.experimental.classRegex": [
["cva\\(((?:[^()]|\\([^()]*\\))*)\\)", "[\"'`]?([^\"'`]+)[\"'`]?"],
["cn\\(((?:[^()]|\\([^()]*\\))*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
// "cva\\(([^)]*)\\)",
// "[\"'`]([^\"'`]*).*?[\"'`]"
],
"vitest.debugExclude": [
"<node_internals>/**",
"**/node_modules/**",
"**/fixtures/**"
]
}

211
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,211 @@
# Contributing
Thanks for your interest in contributing to ui.shadcn.com. We're happy to have you here.
Please take a moment to review this document before submitting your first pull request. We also strongly recommend that you check for open issues and pull requests to see if someone else is working on something similar.
If you need any help, feel free to reach out to [@shadcn](https://twitter.com/shadcn).
## About this repository
This repository is a monorepo.
- We use [pnpm](https://pnpm.io) and [`workspaces`](https://pnpm.io/workspaces) for development.
- We use [Turborepo](https://turbo.build/repo) as our build system.
- We use [changesets](https://github.com/changesets/changesets) for managing releases.
## Structure
This repository is structured as follows:
```
apps
└── www
├── app
├── components
├── content
└── registry
├── default
│ ├── example
│ └── ui
└── new-york
├── example
└── ui
packages
└── cli
```
| Path | Description |
| --------------------- | ---------------------------------------- |
| `apps/www/app` | The Next.js application for the website. |
| `apps/www/components` | The React components for the website. |
| `apps/www/content` | The content for the website. |
| `apps/www/registry` | The registry for the components. |
| `packages/cli` | The `shadcn-ui` package. |
## Development
### Fork this repo
You can fork this repo by clicking the fork button in the top right corner of this page.
### Clone on your local machine
```bash
git clone https://github.com/your-username/ui.git
```
### Navigate to project directory
```bash
cd ui
```
### Create a new Branch
```bash
git checkout -b my-new-branch
```
### Install dependencies
```bash
pnpm install
```
### Run a workspace
You can use the `pnpm --filter=[WORKSPACE]` command to start the development process for a workspace.
#### Examples
1. To run the `ui.shadcn.com` website:
```bash
pnpm --filter=www dev
```
2. To run the `shadcn-ui` package:
```bash
pnpm --filter=shadcn-ui dev
```
## Running the CLI Locally
To run the CLI locally, you can follow the workflow:
1. Start by running the registry (main site) to make sure the components are up to date:
```bash
pnpm www:dev
```
2. Run the development script for the CLI:
```bash
pnpm shadcn:dev
```
3. In another terminal tab, test the CLI by running:
```bash
pnpm shadcn
```
To test the CLI in a specific app, use a command like:
```bash
pnpm shadcn <init | add | ...> -c ~/Desktop/my-app
```
4. To run the tests for the CLI:
```bash
pnpm --filter=shadcn test
```
This workflow ensures that you are running the most recent version of the registry and testing the CLI properly in your local environment.
## Documentation
The documentation for this project is located in the `www` workspace. You can run the documentation locally by running the following command:
```bash
pnpm --filter=www dev
```
Documentation is written using [MDX](https://mdxjs.com). You can find the documentation files in the `apps/www/content/docs` directory.
## Components
We use a registry system for developing components. You can find the source code for the components under `apps/www/registry`. The components are organized by styles.
```bash
apps
└── www
└── registry
├── default
│ ├── example
│ └── ui
└── new-york
├── example
└── ui
```
When adding or modifying components, please ensure that:
1. You make the changes for every style.
2. You update the documentation.
3. You run `pnpm build:registry` to update the registry.
## Commit Convention
Before you create a Pull Request, please check whether your commits comply with
the commit conventions used in this repository.
When you create a commit we kindly ask you to follow the convention
`category(scope or module): message` in your commit message while using one of
the following categories:
- `feat / feature`: all changes that introduce completely new code or new
features
- `fix`: changes that fix a bug (ideally you will additionally reference an
issue if present)
- `refactor`: any code related change that is not a fix nor a feature
- `docs`: changing existing or creating new documentation (i.e. README, docs for
usage of a lib or cli usage)
- `build`: all changes regarding the build of the software, changes to
dependencies or the addition of new dependencies
- `test`: all changes regarding tests (adding new tests or changing existing
ones)
- `ci`: all changes regarding the configuration of continuous integration (i.e.
github actions, ci system)
- `chore`: all changes to the repository that do not fit into any of the above
categories
e.g. `feat(components): add new prop to the avatar component`
If you are interested in the detailed specification you can visit
https://www.conventionalcommits.org/ or check out the
[Angular Commit Message Guidelines](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines).
## Requests for new components
If you have a request for a new component, please open a discussion on GitHub. We'll be happy to help you out.
## CLI
The `shadcn-ui` package is a CLI for adding components to your project. You can find the documentation for the CLI [here](https://ui.shadcn.com/docs/cli).
Any changes to the CLI should be made in the `packages/cli` directory. If you can, it would be great if you could add tests for your changes.
## Testing
Tests are written using [Vitest](https://vitest.dev). You can run all the tests from the root of the repository.
```bash
pnpm test
```
Please ensure that the tests are passing when submitting a pull request. If you're adding new features, please include tests.

View File

@@ -8,6 +8,10 @@ Accessible and customizable components that you can copy and paste into your app
Visit http://ui.shadcn.com/docs to view the documentation.
## Contributing
Please read the [contributing guide](/CONTRIBUTING.md).
## License
Licensed under the [MIT license](https://github.com/shadcn/ui/blob/main/LICENSE.md).

41
apps/v4/.gitignore vendored Normal file
View File

@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# env files (can opt-in for committing if needed)
.env*
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts

6
apps/v4/.prettierignore Normal file
View File

@@ -0,0 +1,6 @@
dist
node_modules
.next
build
.contentlayer
registry/__index__.tsx

1
apps/v4/README.md Normal file
View File

@@ -0,0 +1 @@
This is a wip registry for the `shadcn` canary version. It has React 19 and Tailwind v4 components.

View File

@@ -0,0 +1 @@
// The content of this directory is autogenerated by the registry server.

View File

View File

@@ -0,0 +1 @@
> Files inside this directory is autogenerated by `./scripts/build-registry.ts`. **Do not edit them manually.** - shadcn

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,76 @@
export { ChartAreaDefault } from "@/registry/new-york-v4/charts/chart-area-default"
export { ChartAreaLinear } from "@/registry/new-york-v4/charts/chart-area-linear"
export { ChartAreaStep } from "@/registry/new-york-v4/charts/chart-area-step"
export { ChartAreaLegend } from "@/registry/new-york-v4/charts/chart-area-legend"
export { ChartAreaStacked } from "@/registry/new-york-v4/charts/chart-area-stacked"
export { ChartAreaStackedExpand } from "@/registry/new-york-v4/charts/chart-area-stacked-expand"
export { ChartAreaIcons } from "@/registry/new-york-v4/charts/chart-area-icons"
export { ChartAreaGradient } from "@/registry/new-york-v4/charts/chart-area-gradient"
export { ChartAreaAxes } from "@/registry/new-york-v4/charts/chart-area-axes"
export { ChartAreaInteractive } from "@/registry/new-york-v4/charts/chart-area-interactive"
export { ChartBarDefault } from "@/registry/new-york-v4/charts/chart-bar-default"
export { ChartBarHorizontal } from "@/registry/new-york-v4/charts/chart-bar-horizontal"
export { ChartBarMultiple } from "@/registry/new-york-v4/charts/chart-bar-multiple"
export { ChartBarStacked } from "@/registry/new-york-v4/charts/chart-bar-stacked"
export { ChartBarLabel } from "@/registry/new-york-v4/charts/chart-bar-label"
export { ChartBarLabelCustom } from "@/registry/new-york-v4/charts/chart-bar-label-custom"
export { ChartBarMixed } from "@/registry/new-york-v4/charts/chart-bar-mixed"
export { ChartBarActive } from "@/registry/new-york-v4/charts/chart-bar-active"
export { ChartBarNegative } from "@/registry/new-york-v4/charts/chart-bar-negative"
export { ChartBarInteractive } from "@/registry/new-york-v4/charts/chart-bar-interactive"
export { ChartLineDefault } from "@/registry/new-york-v4/charts/chart-line-default"
export { ChartLineLinear } from "@/registry/new-york-v4/charts/chart-line-linear"
export { ChartLineStep } from "@/registry/new-york-v4/charts/chart-line-step"
export { ChartLineMultiple } from "@/registry/new-york-v4/charts/chart-line-multiple"
export { ChartLineDots } from "@/registry/new-york-v4/charts/chart-line-dots"
export { ChartLineDotsCustom } from "@/registry/new-york-v4/charts/chart-line-dots-custom"
export { ChartLineDotsColors } from "@/registry/new-york-v4/charts/chart-line-dots-colors"
export { ChartLineLabel } from "@/registry/new-york-v4/charts/chart-line-label"
export { ChartLineLabelCustom } from "@/registry/new-york-v4/charts/chart-line-label-custom"
export { ChartLineInteractive } from "@/registry/new-york-v4/charts/chart-line-interactive"
export { ChartPieSimple } from "@/registry/new-york-v4/charts/chart-pie-simple"
export { ChartPieSeparatorNone } from "@/registry/new-york-v4/charts/chart-pie-separator-none"
export { ChartPieLabel } from "@/registry/new-york-v4/charts/chart-pie-label"
export { ChartPieLabelCustom } from "@/registry/new-york-v4/charts/chart-pie-label-custom"
export { ChartPieLabelList } from "@/registry/new-york-v4/charts/chart-pie-label-list"
export { ChartPieLegend } from "@/registry/new-york-v4/charts/chart-pie-legend"
export { ChartPieDonut } from "@/registry/new-york-v4/charts/chart-pie-donut"
export { ChartPieDonutActive } from "@/registry/new-york-v4/charts/chart-pie-donut-active"
export { ChartPieDonutText } from "@/registry/new-york-v4/charts/chart-pie-donut-text"
export { ChartPieStacked } from "@/registry/new-york-v4/charts/chart-pie-stacked"
export { ChartPieInteractive } from "@/registry/new-york-v4/charts/chart-pie-interactive"
export { ChartRadarDefault } from "@/registry/new-york-v4/charts/chart-radar-default"
export { ChartRadarDots } from "@/registry/new-york-v4/charts/chart-radar-dots"
export { ChartRadarLinesOnly } from "@/registry/new-york-v4/charts/chart-radar-lines-only"
export { ChartRadarLabelCustom } from "@/registry/new-york-v4/charts/chart-radar-label-custom"
export { ChartRadarGridCustom } from "@/registry/new-york-v4/charts/chart-radar-grid-custom"
export { ChartRadarGridNone } from "@/registry/new-york-v4/charts/chart-radar-grid-none"
export { ChartRadarGridCircle } from "@/registry/new-york-v4/charts/chart-radar-grid-circle"
export { ChartRadarGridCircleNoLines } from "@/registry/new-york-v4/charts/chart-radar-grid-circle-no-lines"
export { ChartRadarGridCircleFill } from "@/registry/new-york-v4/charts/chart-radar-grid-circle-fill"
export { ChartRadarGridFill } from "@/registry/new-york-v4/charts/chart-radar-grid-fill"
export { ChartRadarMultiple } from "@/registry/new-york-v4/charts/chart-radar-multiple"
export { ChartRadarLegend } from "@/registry/new-york-v4/charts/chart-radar-legend"
export { ChartRadarIcons } from "@/registry/new-york-v4/charts/chart-radar-icons"
export { ChartRadarRadius } from "@/registry/new-york-v4/charts/chart-radar-radius"
export { ChartRadialSimple } from "@/registry/new-york-v4/charts/chart-radial-simple"
export { ChartRadialLabel } from "@/registry/new-york-v4/charts/chart-radial-label"
export { ChartRadialGrid } from "@/registry/new-york-v4/charts/chart-radial-grid"
export { ChartRadialText } from "@/registry/new-york-v4/charts/chart-radial-text"
export { ChartRadialShape } from "@/registry/new-york-v4/charts/chart-radial-shape"
export { ChartRadialStacked } from "@/registry/new-york-v4/charts/chart-radial-stacked"
export { ChartTooltipDefault } from "@/registry/new-york-v4/charts/chart-tooltip-default"
export { ChartTooltipIndicatorLine } from "@/registry/new-york-v4/charts/chart-tooltip-indicator-line"
export { ChartTooltipIndicatorNone } from "@/registry/new-york-v4/charts/chart-tooltip-indicator-none"
export { ChartTooltipLabelCustom } from "@/registry/new-york-v4/charts/chart-tooltip-label-custom"
export { ChartTooltipLabelFormatter } from "@/registry/new-york-v4/charts/chart-tooltip-label-formatter"
export { ChartTooltipLabelNone } from "@/registry/new-york-v4/charts/chart-tooltip-label-none"
export { ChartTooltipFormatter } from "@/registry/new-york-v4/charts/chart-tooltip-formatter"
export { ChartTooltipIcons } from "@/registry/new-york-v4/charts/chart-tooltip-icons"
export { ChartTooltipAdvanced } from "@/registry/new-york-v4/charts/chart-tooltip-advanced"

View File

@@ -0,0 +1,20 @@
import { ComponentWrapper } from "@/components/component-wrapper"
import * as Charts from "@/app/(app)/charts/charts"
export default function ChartsPage() {
return (
<div className="grid grid-cols-3 items-start gap-4 p-4 2xl:grid-cols-4">
{Object.entries(Charts)
.sort()
.map(([key, Component]) => (
<ComponentWrapper
key={key}
name={key}
className="w-auto data-[name=chartareainteractive]:col-span-3 data-[name=chartbarinteractive]:col-span-3 data-[name=chartlineinteractive]:col-span-3 **:data-[slot=card]:w-full"
>
<Component />
</ComponentWrapper>
))}
</div>
)
}

View File

@@ -0,0 +1,45 @@
import { cookies } from "next/headers"
import { AppSidebar } from "@/components/app-sidebar"
import { ModeSwitcher } from "@/components/mode-switcher"
import { NavHeader } from "@/components/nav-header"
import { Separator } from "@/registry/new-york-v4/ui/separator"
import {
SidebarInset,
SidebarProvider,
SidebarTrigger,
} from "@/registry/new-york-v4/ui/sidebar"
export default async function AppLayout({
children,
}: Readonly<{
children: React.ReactNode
}>) {
const cookieStore = await cookies()
const defaultOpen = cookieStore.get("sidebar_state")?.value === "true"
return (
<SidebarProvider
defaultOpen={defaultOpen}
className="flex flex-col pt-(--header-height) [--header-height:calc(--spacing(14))]"
>
<header className="bg-background fixed inset-x-0 top-0 isolate z-10 flex shrink-0 items-center gap-2 border-b">
<div className="flex h-(--header-height) w-full items-center gap-2 px-4">
<SidebarTrigger className="-ml-1.5" />
<Separator
orientation="vertical"
className="mr-2 data-[orientation=vertical]:h-4"
/>
<NavHeader />
<div className="ml-auto flex items-center gap-2">
<ModeSwitcher />
</div>
</div>
</header>
<div className="flex flex-1">
<AppSidebar />
<SidebarInset>{children}</SidebarInset>
</div>
</SidebarProvider>
)
}

196
apps/v4/app/(app)/page.tsx Normal file
View File

@@ -0,0 +1,196 @@
import { AccordionDemo } from "@/components/accordion-demo"
import { AlertDemo } from "@/components/alert-demo"
import { AlertDialogDemo } from "@/components/alert-dialog-demo"
import { AspectRatioDemo } from "@/components/aspect-ratio-demo"
import { AvatarDemo } from "@/components/avatar-demo"
import { BadgeDemo } from "@/components/badge-demo"
import { BreadcrumbDemo } from "@/components/breadcrumb-demo"
import { ButtonDemo } from "@/components/button-demo"
import { CalendarDemo } from "@/components/calendar-demo"
import { CardDemo } from "@/components/card-demo"
import { CarouselDemo } from "@/components/carousel-demo"
import { ChartDemo } from "@/components/chart-demo"
import { CheckboxDemo } from "@/components/checkbox-demo"
import { CollapsibleDemo } from "@/components/collapsible-demo"
import { ComboboxDemo } from "@/components/combobox-demo"
import { CommandDemo } from "@/components/command-demo"
import { ComponentWrapper } from "@/components/component-wrapper"
import { ContextMenuDemo } from "@/components/context-menu-demo"
import { DatePickerDemo } from "@/components/date-picker-demo"
import { DialogDemo } from "@/components/dialog-demo"
import { DrawerDemo } from "@/components/drawer-demo"
import { DropdownMenuDemo } from "@/components/dropdown-menu-demo"
import { FormDemo } from "@/components/form-demo"
import { HoverCardDemo } from "@/components/hover-card-demo"
import { InputDemo } from "@/components/input-demo"
import { InputOTPDemo } from "@/components/input-otp-demo"
import { LabelDemo } from "@/components/label-demo"
import { MenubarDemo } from "@/components/menubar-demo"
import { NavigationMenuDemo } from "@/components/navigation-menu-demo"
import { PaginationDemo } from "@/components/pagination-demo"
import { PopoverDemo } from "@/components/popover-demo"
import { ProgressDemo } from "@/components/progress-demo"
import { RadioGroupDemo } from "@/components/radio-group-demo"
import { ResizableDemo } from "@/components/resizable-demo"
import { ScrollAreaDemo } from "@/components/scroll-area-demo"
import { SelectDemo } from "@/components/select-demo"
import { SeparatorDemo } from "@/components/separator-demo"
import { SheetDemo } from "@/components/sheet-demo"
import { SkeletonDemo } from "@/components/skeleton-demo"
import { SliderDemo } from "@/components/slider-demo"
import { SonnerDemo } from "@/components/sonner-demo"
import { SwitchDemo } from "@/components/switch-demo"
import { TableDemo } from "@/components/table-demo"
import { TabsDemo } from "@/components/tabs-demo"
import { TextareaDemo } from "@/components/textarea-demo"
import { ToggleDemo } from "@/components/toggle-demo"
import { ToggleGroupDemo } from "@/components/toggle-group-demo"
import { TooltipDemo } from "@/components/tooltip-demo"
export default function SinkPage() {
return (
<div className="grid gap-4 p-4">
<ComponentWrapper name="accordion">
<AccordionDemo />
</ComponentWrapper>
<ComponentWrapper name="alert">
<AlertDemo />
</ComponentWrapper>
<ComponentWrapper name="alert-dialog">
<AlertDialogDemo />
</ComponentWrapper>
<ComponentWrapper name="aspect-ratio">
<AspectRatioDemo />
</ComponentWrapper>
<ComponentWrapper name="avatar">
<AvatarDemo />
</ComponentWrapper>
<ComponentWrapper name="badge">
<BadgeDemo />
</ComponentWrapper>
<ComponentWrapper name="breadcrumb">
<BreadcrumbDemo />
</ComponentWrapper>
<ComponentWrapper name="button">
<ButtonDemo />
</ComponentWrapper>
<ComponentWrapper name="calendar">
<CalendarDemo />
</ComponentWrapper>
<ComponentWrapper name="card">
<CardDemo />
</ComponentWrapper>
<ComponentWrapper name="carousel" className="hidden md:flex">
<CarouselDemo />
</ComponentWrapper>
<ComponentWrapper name="chart" className="w-full">
<ChartDemo />
</ComponentWrapper>
<ComponentWrapper name="checkbox">
<CheckboxDemo />
</ComponentWrapper>
<ComponentWrapper name="collapsible">
<CollapsibleDemo />
</ComponentWrapper>
<ComponentWrapper name="combobox">
<ComboboxDemo />
</ComponentWrapper>
<ComponentWrapper name="command">
<CommandDemo />
</ComponentWrapper>
<ComponentWrapper name="context-menu">
<ContextMenuDemo />
</ComponentWrapper>
<ComponentWrapper name="date-picker">
<DatePickerDemo />
</ComponentWrapper>
<ComponentWrapper name="dialog">
<DialogDemo />
</ComponentWrapper>
<ComponentWrapper name="drawer">
<DrawerDemo />
</ComponentWrapper>
<ComponentWrapper name="dropdown-menu">
<DropdownMenuDemo />
</ComponentWrapper>
<ComponentWrapper name="form">
<FormDemo />
</ComponentWrapper>
<ComponentWrapper name="hover-card">
<HoverCardDemo />
</ComponentWrapper>
<ComponentWrapper name="input">
<InputDemo />
</ComponentWrapper>
<ComponentWrapper name="input-otp">
<InputOTPDemo />
</ComponentWrapper>
<ComponentWrapper name="label">
<LabelDemo />
</ComponentWrapper>
<ComponentWrapper name="menubar">
<MenubarDemo />
</ComponentWrapper>
<ComponentWrapper name="navigation-menu">
<NavigationMenuDemo />
</ComponentWrapper>
<ComponentWrapper name="pagination">
<PaginationDemo />
</ComponentWrapper>
<ComponentWrapper name="popover">
<PopoverDemo />
</ComponentWrapper>
<ComponentWrapper name="progress">
<ProgressDemo />
</ComponentWrapper>
<ComponentWrapper name="radio-group">
<RadioGroupDemo />
</ComponentWrapper>
<ComponentWrapper name="resizable">
<ResizableDemo />
</ComponentWrapper>
<ComponentWrapper name="scroll-area">
<ScrollAreaDemo />
</ComponentWrapper>
<ComponentWrapper name="select">
<SelectDemo />
</ComponentWrapper>
<ComponentWrapper name="separator">
<SeparatorDemo />
</ComponentWrapper>
<ComponentWrapper name="sheet">
<SheetDemo />
</ComponentWrapper>
<ComponentWrapper name="skeleton">
<SkeletonDemo />
</ComponentWrapper>
<ComponentWrapper name="slider">
<SliderDemo />
</ComponentWrapper>
<ComponentWrapper name="sonner">
<SonnerDemo />
</ComponentWrapper>
<ComponentWrapper name="switch">
<SwitchDemo />
</ComponentWrapper>
<ComponentWrapper name="table">
<TableDemo />
</ComponentWrapper>
<ComponentWrapper name="tabs">
<TabsDemo />
</ComponentWrapper>
<ComponentWrapper name="textarea">
<TextareaDemo />
</ComponentWrapper>
<ComponentWrapper name="toggle">
<ToggleDemo />
</ComponentWrapper>
<ComponentWrapper name="toggle-group">
<ToggleGroupDemo />
</ComponentWrapper>
<ComponentWrapper name="tooltip">
<TooltipDemo />
</ComponentWrapper>
</div>
)
}

View File

@@ -0,0 +1,96 @@
import * as React from "react"
import { Metadata } from "next"
import { notFound } from "next/navigation"
import { registryItemSchema } from "shadcn/registry"
import { z } from "zod"
import { getRegistryComponent, getRegistryItem } from "@/lib/registry"
import { absoluteUrl, cn } from "@/lib/utils"
import { siteConfig } from "@/www/config/site"
const getCachedRegistryItem = React.cache(async (name: string) => {
return await getRegistryItem(name)
})
export async function generateMetadata({
params,
}: {
params: Promise<{
name: string
}>
}): Promise<Metadata> {
const { name } = await params
const item = await getCachedRegistryItem(name)
if (!item) {
return {}
}
const title = item.name
const description = item.description
return {
title: `${item.name}${item.description ? ` - ${item.description}` : ""}`,
description,
openGraph: {
title,
description,
type: "article",
url: absoluteUrl(`/blocks/${item.name}`),
images: [
{
url: siteConfig.ogImage,
width: 1200,
height: 630,
alt: siteConfig.name,
},
],
},
twitter: {
card: "summary_large_image",
title,
description,
images: [siteConfig.ogImage],
creator: "@shadcn",
},
}
}
export const dynamicParams = false
export async function generateStaticParams() {
const { Index } = await import("@/__registry__")
const index = z.record(registryItemSchema).parse(Index)
return Object.values(index)
.filter((block) =>
["registry:block", "registry:component"].includes(block.type)
)
.map((block) => ({
name: block.name,
}))
}
export default async function BlockPage({
params,
}: {
params: Promise<{
name: string
}>
}) {
const { name } = await params
const item = await getCachedRegistryItem(name)
const Component = getRegistryComponent(name)
if (!item || !Component) {
return notFound()
}
return (
<>
<div className={cn("themes-wrapper bg-background", item.meta?.container)}>
<Component />
</div>
</>
)
}

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

144
apps/v4/app/globals.css Normal file
View File

@@ -0,0 +1,144 @@
@import "tailwindcss";
@plugin "tailwindcss-animate";
@custom-variant dark (&:is(.dark *));
:root {
--background: hsl(0 0% 100%);
--foreground: hsl(240 10% 3.9%);
--card: hsl(0 0% 100%);
--card-foreground: hsl(240 10% 3.9%);
--popover: hsl(0 0% 100%);
--popover-foreground: hsl(240 10% 3.9%);
--primary: hsl(240 5.9% 10%);
--primary-foreground: hsl(0 0% 98%);
--secondary: hsl(240 4.8% 95.9%);
--secondary-foreground: hsl(240 5.9% 10%);
--muted: hsl(240 4.8% 95.9%);
--muted-foreground: hsl(240 3.8% 46.1%);
--accent: hsl(240 4.8% 95.9%);
--accent-foreground: hsl(240 5.9% 10%);
--destructive: hsl(0 84.2% 60.2%);
--destructive-foreground: hsl(0 0% 98%);
--border: hsl(240 5.9% 90%);
--input: hsl(240 5.9% 90%);
--ring: hsl(240 10% 3.9%);
--chart-1: hsl(12 76% 61%);
--chart-2: hsl(173 58% 39%);
--chart-3: hsl(197 37% 24%);
--chart-4: hsl(43 74% 66%);
--chart-5: hsl(27 87% 67%);
--radius: 0.6rem;
--sidebar-background: hsl(0 0% 98%);
--sidebar-foreground: hsl(240 5.3% 26.1%);
--sidebar-primary: hsl(240 5.9% 10%);
--sidebar-primary-foreground: hsl(0 0% 98%);
--sidebar-accent: hsl(240 4.8% 95.9%);
--sidebar-accent-foreground: hsl(240 5.9% 10%);
--sidebar-border: hsl(220 13% 91%);
--sidebar-ring: hsl(217.2 91.2% 59.8%);
}
.dark {
--background: hsl(240 10% 3.9%);
--foreground: hsl(0 0% 98%);
--card: hsl(240 10% 3.9%);
--card-foreground: hsl(0 0% 98%);
--popover: hsl(240 10% 3.9%);
--popover-foreground: hsl(0 0% 98%);
--primary: hsl(0 0% 98%);
--primary-foreground: hsl(240 5.9% 10%);
--secondary: hsl(240 3.7% 15.9%);
--secondary-foreground: hsl(0 0% 98%);
--muted: hsl(240 3.7% 15.9%);
--muted-foreground: hsl(240 5% 64.9%);
--accent: hsl(240 3.7% 15.9%);
--accent-foreground: hsl(0 0% 98%);
--destructive: hsl(0 62.8% 30.6%);
--destructive-foreground: hsl(0 0% 98%);
--border: hsl(240 3.7% 15.9%);
--input: hsl(240 3.7% 15.9%);
--ring: hsl(240 4.9% 83.9%);
--chart-1: hsl(220 70% 50%);
--chart-2: hsl(160 60% 45%);
--chart-3: hsl(30 80% 55%);
--chart-4: hsl(280 65% 60%);
--chart-5: hsl(340 75% 55%);
--sidebar-background: hsl(240 5.9% 10%);
--sidebar-foreground: hsl(240 4.8% 95.9%);
--sidebar-primary: hsl(224.3 76.3% 48%);
--sidebar-primary-foreground: hsl(0 0% 100%);
--sidebar-accent: hsl(240 3.7% 15.9%);
--sidebar-accent-foreground: hsl(240 4.8% 95.9%);
--sidebar-border: hsl(240 3.7% 15.9%);
--sidebar-ring: hsl(217.2 91.2% 59.8%);
}
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-card: var(--card);
--color-card-foreground: var(--card-foreground);
--color-popover: var(--popover);
--color-popover-foreground: var(--popover-foreground);
--color-primary: var(--primary);
--color-primary-foreground: var(--primary-foreground);
--color-secondary: var(--secondary);
--color-secondary-foreground: var(--secondary-foreground);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
--color-accent: var(--accent);
--color-accent-foreground: var(--accent-foreground);
--color-destructive: var(--destructive);
--color-destructive-foreground: var(--destructive-foreground);
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);
--color-chart-1: var(--chart-1);
--color-chart-2: var(--chart-2);
--color-chart-3: var(--chart-3);
--color-chart-4: var(--chart-4);
--color-chart-5: var(--chart-5);
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
--color-sidebar-ring: var(--sidebar-ring);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
--color-sidebar-accent: var(--sidebar-accent);
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
--color-sidebar-primary: var(--sidebar-primary);
--color-sidebar-foreground: var(--sidebar-foreground);
--color-sidebar: var(--sidebar-background);
--animate-accordion-down: accordion-down 0.2s ease-out;
--animate-accordion-up: accordion-up 0.2s ease-out;
@keyframes accordion-down {
from {
height: 0;
}
to {
height: var(--radix-accordion-content-height);
}
}
@keyframes accordion-up {
from {
height: var(--radix-accordion-content-height);
}
to {
height: 0;
}
}
}
@layer base {
* {
@apply border-border outline-ring/50;
}
body {
@apply bg-background text-foreground;
}
}

118
apps/v4/app/layout.tsx Normal file
View File

@@ -0,0 +1,118 @@
import type { Metadata, Viewport } from "next"
import { GeistMono } from "geist/font/mono"
import { GeistSans } from "geist/font/sans"
import { cn } from "@/lib/utils"
import { Analytics } from "@/components/analytics"
import { ThemeProvider } from "@/components/theme-provider"
import { Toaster } from "@/registry/new-york-v4/ui/sonner"
import { siteConfig } from "@/www/config/site"
import "./globals.css"
const fontSans = GeistSans
const fontMono = GeistMono
const META_THEME_COLORS = {
light: "#ffffff",
dark: "#09090b",
}
export const metadata: Metadata = {
title: {
default: siteConfig.name,
template: `%s - ${siteConfig.name}`,
},
metadataBase: new URL(siteConfig.url),
description: siteConfig.description,
keywords: [
"Next.js",
"React",
"Tailwind CSS",
"Server Components",
"Radix UI",
],
authors: [
{
name: "shadcn",
url: "https://shadcn.com",
},
],
creator: "shadcn",
openGraph: {
type: "website",
locale: "en_US",
url: siteConfig.url,
title: siteConfig.name,
description: siteConfig.description,
siteName: siteConfig.name,
images: [
{
url: siteConfig.ogImage,
width: 1200,
height: 630,
alt: siteConfig.name,
},
],
},
twitter: {
card: "summary_large_image",
title: siteConfig.name,
description: siteConfig.description,
images: [siteConfig.ogImage],
creator: "@shadcn",
},
icons: {
icon: "/favicon.ico",
shortcut: "/favicon-16x16.png",
apple: "/apple-touch-icon.png",
},
manifest: `${siteConfig.url}/site.webmanifest`,
}
export const viewport: Viewport = {
themeColor: META_THEME_COLORS.light,
}
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode
}>) {
return (
<html lang="en" suppressHydrationWarning>
<head>
<script
dangerouslySetInnerHTML={{
__html: `
try {
if (localStorage.theme === 'dark' || ((!('theme' in localStorage) || localStorage.theme === 'system') && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '${META_THEME_COLORS.dark}')
}
} catch (_) {}
`,
}}
/>
</head>
<body
className={cn(
"bg-background min-h-svh overscroll-none font-sans antialiased",
fontSans.variable,
fontMono.variable
)}
>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
{children}
<Toaster />
<Analytics />
</ThemeProvider>
</body>
</html>
)
}

21
apps/v4/components.json Normal file
View File

@@ -0,0 +1,21 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "",
"css": "app/globals.css",
"baseColor": "zinc",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"iconLibrary": "lucide"
}

View File

@@ -0,0 +1,72 @@
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/registry/new-york-v4/ui/accordion"
export function AccordionDemo() {
return (
<div className="grid w-full max-w-xl gap-4">
<Accordion type="single" collapsible className="w-full">
<AccordionItem value="item-1">
<AccordionTrigger>Is it accessible?</AccordionTrigger>
<AccordionContent>
Yes. It adheres to the WAI-ARIA design pattern.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Is it styled?</AccordionTrigger>
<AccordionContent>
Yes. It comes with default styles that matches the other
components&apos; aesthetic.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-3">
<AccordionTrigger>Is it animated?</AccordionTrigger>
<AccordionContent>
Yes. It&apos;s animated by default, but you can disable it if you
prefer.
</AccordionContent>
</AccordionItem>
</Accordion>
<Accordion type="single" collapsible className="w-full">
<AccordionItem value="item-1">
<AccordionTrigger>
What are the key considerations when implementing a comprehensive
enterprise-level authentication system?
</AccordionTrigger>
<AccordionContent>
Implementing a robust enterprise authentication system requires
careful consideration of multiple factors. This includes secure
password hashing and storage, multi-factor authentication (MFA)
implementation, session management, OAuth2 and SSO integration,
regular security audits, rate limiting to prevent brute force
attacks, and maintaining detailed audit logs. Additionally,
you&apos;ll need to consider scalability, performance impact, and
compliance with relevant data protection regulations such as GDPR or
HIPAA.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>
How does modern distributed system architecture handle eventual
consistency and data synchronization across multiple regions?
</AccordionTrigger>
<AccordionContent>
Modern distributed systems employ various strategies to maintain
data consistency across regions. This often involves using
techniques like CRDT (Conflict-Free Replicated Data Types), vector
clocks, and gossip protocols. Systems might implement event sourcing
patterns, utilize message queues for asynchronous updates, and
employ sophisticated conflict resolution strategies. Popular
solutions like Amazon&apos;s DynamoDB and Google&apos;s Spanner
demonstrate different approaches to solving these challenges,
balancing between consistency, availability, and partition tolerance
as described in the CAP theorem.
</AccordionContent>
</AccordionItem>
</Accordion>
</div>
)
}

View File

@@ -0,0 +1,113 @@
import {
AlertCircleIcon,
BookmarkCheckIcon,
CheckCircle2Icon,
GiftIcon,
PopcornIcon,
ShieldAlertIcon,
} from "lucide-react"
import {
Alert,
AlertDescription,
AlertTitle,
} from "@/registry/new-york-v4/ui/alert"
import { Button } from "@/registry/new-york-v4/ui/button"
export function AlertDemo() {
return (
<div className="grid max-w-xl items-start gap-4">
<Alert>
<CheckCircle2Icon />
<AlertTitle>Success! Your changes have been saved</AlertTitle>
<AlertDescription>
This is an alert with icon, title and description.
</AlertDescription>
</Alert>
<Alert>
<BookmarkCheckIcon>Heads up!</BookmarkCheckIcon>
<AlertDescription>
This one has an icon and a description only. No title.
</AlertDescription>
</Alert>
<Alert>
<AlertDescription>
This one has a description only. No title. No icon.
</AlertDescription>
</Alert>
<Alert>
<PopcornIcon />
<AlertTitle>Let&apos;s try one with icon and title.</AlertTitle>
</Alert>
<Alert>
<ShieldAlertIcon />
<AlertTitle>
This is a very long alert title that demonstrates how the component
handles extended text content and potentially wraps across multiple
lines
</AlertTitle>
</Alert>
<Alert>
<GiftIcon />
<AlertDescription>
This is a very long alert description that demonstrates how the
component handles extended text content and potentially wraps across
multiple lines
</AlertDescription>
</Alert>
<Alert>
<AlertCircleIcon />
<AlertTitle>
This is an extremely long alert title that spans multiple lines to
demonstrate how the component handles very lengthy headings while
maintaining readability and proper text wrapping behavior
</AlertTitle>
<AlertDescription>
This is an equally long description that contains detailed information
about the alert. It shows how the component can accommodate extensive
content while preserving proper spacing, alignment, and readability
across different screen sizes and viewport widths. This helps ensure
the user experience remains consistent regardless of the content
length.
</AlertDescription>
</Alert>
<Alert variant="destructive">
<AlertCircleIcon />
<AlertTitle>Something went wrong!</AlertTitle>
<AlertDescription>
Your session has expired. Please log in again.
</AlertDescription>
</Alert>
<Alert variant="destructive">
<AlertCircleIcon />
<AlertTitle>Unable to process your payment.</AlertTitle>
<AlertDescription>
<p>Please verify your billing information and try again.</p>
<ul className="list-inside list-disc text-sm">
<li>Check your card details</li>
<li>Ensure sufficient funds</li>
<li>Verify billing address</li>
</ul>
</AlertDescription>
</Alert>
<Alert>
<CheckCircle2Icon />
<AlertTitle>The selected emails have been marked as spam.</AlertTitle>
<Button
size="sm"
variant="outline"
className="absolute top-2.5 right-3 h-6 shadow-none"
>
Undo
</Button>
</Alert>
<Alert className="border-amber-50 bg-amber-50 text-amber-900 dark:border-amber-950 dark:bg-amber-950 dark:text-amber-100">
<CheckCircle2Icon />
<AlertTitle>Plot Twist: This Alert is Actually Amber!</AlertTitle>
<AlertDescription>
This one has custom colors for light and dark mode.
</AlertDescription>
</Alert>
</div>
)
}

View File

@@ -0,0 +1,35 @@
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/registry/new-york-v4/ui/alert-dialog"
import { Button } from "@/registry/new-york-v4/ui/button"
export function AlertDialogDemo() {
return (
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="outline">Show Dialog</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. This will permanently delete your
account and remove your data from our servers.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction>Continue</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
)
}

View File

@@ -0,0 +1,7 @@
"use client"
import { Analytics as VercelAnalytics } from "@vercel/analytics/react"
export function Analytics() {
return <VercelAnalytics />
}

View File

@@ -0,0 +1,247 @@
"use client"
import * as React from "react"
import { Index } from "@/__registry__"
import {
AudioWaveform,
BookOpen,
Bot,
ChevronRightIcon,
Command,
GalleryVerticalEnd,
Search,
Settings2,
SquareTerminal,
} from "lucide-react"
import { NavUser } from "@/registry/new-york-v4/blocks/sidebar-07/components/nav-user"
import { TeamSwitcher } from "@/registry/new-york-v4/blocks/sidebar-07/components/team-switcher"
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
} from "@/registry/new-york-v4/ui/collapsible"
import { Label } from "@/registry/new-york-v4/ui/label"
import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarGroup,
SidebarGroupContent,
SidebarGroupLabel,
SidebarHeader,
SidebarInput,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
SidebarMenuSub,
SidebarMenuSubButton,
SidebarMenuSubItem,
SidebarRail,
} from "@/registry/new-york-v4/ui/sidebar"
// This is sample data.
const data = {
user: {
name: "shadcn",
email: "m@example.com",
avatar: "/avatars/shadcn.jpg",
},
teams: [
{
name: "Acme Inc",
logo: GalleryVerticalEnd,
plan: "Enterprise",
},
{
name: "Acme Corp.",
logo: AudioWaveform,
plan: "Startup",
},
{
name: "Evil Corp.",
logo: Command,
plan: "Free",
},
],
navMain: [
{
title: "Playground",
url: "#",
icon: SquareTerminal,
isActive: true,
items: [
{
title: "History",
url: "#",
},
{
title: "Starred",
url: "#",
},
{
title: "Settings",
url: "#",
},
],
},
{
title: "Models",
url: "#",
icon: Bot,
items: [
{
title: "Genesis",
url: "#",
},
{
title: "Explorer",
url: "#",
},
{
title: "Quantum",
url: "#",
},
],
},
{
title: "Documentation",
url: "#",
icon: BookOpen,
items: [
{
title: "Introduction",
url: "#",
},
{
title: "Get Started",
url: "#",
},
{
title: "Tutorials",
url: "#",
},
{
title: "Changelog",
url: "#",
},
],
},
{
title: "Settings",
url: "#",
icon: Settings2,
items: [
{
title: "General",
url: "#",
},
{
title: "Team",
url: "#",
},
{
title: "Billing",
url: "#",
},
{
title: "Limits",
url: "#",
},
],
},
],
components: Object.values(Index).filter(
(item) => item.type === "registry:ui"
),
}
export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
return (
<Sidebar
collapsible="icon"
className="top-(--delta) h-[calc(100svh-var(--delta))]! [--delta:calc(var(--header-height)+1px)]"
{...props}
>
<SidebarHeader>
<TeamSwitcher teams={data.teams} />
<SidebarGroup className="py-0 group-data-[collapsible=icon]:hidden">
<SidebarGroupContent>
<form className="relative">
<Label htmlFor="search" className="sr-only">
Search
</Label>
<SidebarInput
id="search"
placeholder="Search the docs..."
className="pl-8"
/>
<Search className="pointer-events-none absolute top-1/2 left-2 size-4 -translate-y-1/2 opacity-50 select-none" />
</form>
</SidebarGroupContent>
</SidebarGroup>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarGroupLabel>Platform</SidebarGroupLabel>
<SidebarMenu>
{data.navMain.map((item) => (
<Collapsible
key={item.title}
asChild
defaultOpen={item.isActive}
className="group/collapsible"
>
<SidebarMenuItem>
<CollapsibleTrigger asChild>
<SidebarMenuButton tooltip={item.title}>
{item.icon && <item.icon />}
<span>{item.title}</span>
<ChevronRightIcon className="ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" />
</SidebarMenuButton>
</CollapsibleTrigger>
<CollapsibleContent>
<SidebarMenuSub>
{item.items?.map((subItem) => (
<SidebarMenuSubItem key={subItem.title}>
<SidebarMenuSubButton asChild>
<a href={subItem.url}>
<span>{subItem.title}</span>
</a>
</SidebarMenuSubButton>
</SidebarMenuSubItem>
))}
</SidebarMenuSub>
</CollapsibleContent>
</SidebarMenuItem>
</Collapsible>
))}
</SidebarMenu>
</SidebarGroup>
<SidebarGroup className="group-data-[collapsible=icon]:hidden">
<SidebarGroupLabel>Components</SidebarGroupLabel>
<SidebarMenu>
{data.components.map((item) => (
<SidebarMenuItem key={item.name}>
<SidebarMenuButton asChild>
<a href={`/#${item.name}`}>
<span>{getComponentName(item.name)}</span>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
))}
</SidebarMenu>
</SidebarGroup>
</SidebarContent>
<SidebarFooter>
<NavUser user={data.user} />
</SidebarFooter>
<SidebarRail />
</Sidebar>
)
}
function getComponentName(name: string) {
// convert kebab-case to title case
return name.replace(/-/g, " ").replace(/\b\w/g, (char) => char.toUpperCase())
}

View File

@@ -0,0 +1,26 @@
import Image from "next/image"
import { AspectRatio } from "@/registry/new-york-v4/ui/aspect-ratio"
export function AspectRatioDemo() {
return (
<div className="grid w-full max-w-sm items-start gap-4">
<AspectRatio ratio={16 / 9} className="bg-muted">
<Image
src="https://images.unsplash.com/photo-1588345921523-c2dcdb7f1dcd?w=800&dpr=2&q=80"
alt="Photo by Drew Beamer"
fill
className="h-full w-full rounded-md object-cover dark:brightness-[0.2] dark:grayscale"
/>
</AspectRatio>
<AspectRatio ratio={1 / 1} className="bg-muted">
<Image
src="https://images.unsplash.com/photo-1588345921523-c2dcdb7f1dcd?w=800&dpr=2&q=80"
alt="Photo by Drew Beamer"
fill
className="h-full w-full rounded-md object-cover dark:brightness-[0.2] dark:grayscale"
/>
</AspectRatio>
</div>
)
}

View File

@@ -0,0 +1,81 @@
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/registry/new-york-v4/ui/avatar"
export function AvatarDemo() {
return (
<div className="flex flex-col items-center gap-4 md:flex-row">
<Avatar>
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
<AvatarFallback>CN</AvatarFallback>
</Avatar>
<Avatar>
<AvatarFallback>CN</AvatarFallback>
</Avatar>
<Avatar className="size-12">
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
<AvatarFallback>CN</AvatarFallback>
</Avatar>
<Avatar className="rounded-lg">
<AvatarImage
src="https://github.com/evilrabbit.png"
alt="@evilrabbit"
/>
<AvatarFallback>ER</AvatarFallback>
</Avatar>
<div className="*:data-[slot=avatar]:ring-background flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:grayscale">
<Avatar>
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
<AvatarFallback>CN</AvatarFallback>
</Avatar>
<Avatar>
<AvatarImage src="https://github.com/leerob.png" alt="@leerob" />
<AvatarFallback>LR</AvatarFallback>
</Avatar>
<Avatar>
<AvatarImage
src="https://github.com/evilrabbit.png"
alt="@evilrabbit"
/>
<AvatarFallback>ER</AvatarFallback>
</Avatar>
</div>
<div className="*:data-[slot=avatar]:ring-background flex -space-x-2 *:data-[slot=avatar]:size-12 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:grayscale">
<Avatar>
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
<AvatarFallback>CN</AvatarFallback>
</Avatar>
<Avatar>
<AvatarImage src="https://github.com/leerob.png" alt="@leerob" />
<AvatarFallback>LR</AvatarFallback>
</Avatar>
<Avatar>
<AvatarImage
src="https://github.com/evilrabbit.png"
alt="@evilrabbit"
/>
<AvatarFallback>ER</AvatarFallback>
</Avatar>
</div>
<div className="*:data-[slot=avatar]:ring-background flex -space-x-2 hover:space-x-1 *:data-[slot=avatar]:size-12 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:grayscale *:data-[slot=avatar]:transition-all *:data-[slot=avatar]:duration-300 *:data-[slot=avatar]:ease-in-out">
<Avatar>
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
<AvatarFallback>CN</AvatarFallback>
</Avatar>
<Avatar>
<AvatarImage src="https://github.com/leerob.png" alt="@leerob" />
<AvatarFallback>LR</AvatarFallback>
</Avatar>
<Avatar>
<AvatarImage
src="https://github.com/evilrabbit.png"
alt="@evilrabbit"
/>
<AvatarFallback>ER</AvatarFallback>
</Avatar>
</div>
</div>
)
}

View File

@@ -0,0 +1,49 @@
import { AlertCircleIcon, ArrowRightIcon, CheckIcon } from "lucide-react"
import { Badge } from "@/registry/new-york-v4/ui/badge"
export function BadgeDemo() {
return (
<div className="flex flex-col items-center gap-2">
<div className="flex w-full flex-col gap-2 md:flex-row">
<Badge>Badge</Badge>
<Badge variant="secondary">Secondary</Badge>
<Badge variant="destructive">Destructive</Badge>
<Badge variant="outline">Outline</Badge>
<Badge variant="outline">
<CheckIcon />
Badge
</Badge>
<Badge variant="destructive">
<AlertCircleIcon />
Alert
</Badge>
<Badge className="size-5 rounded-full p-0 font-mono tabular-nums">
8
</Badge>
</div>
<div className="flex w-full flex-col gap-2 md:flex-row">
<Badge asChild>
<a href="#">
Link <ArrowRightIcon />
</a>
</Badge>
<Badge asChild variant="secondary">
<a href="#">
Link <ArrowRightIcon />
</a>
</Badge>
<Badge asChild variant="destructive">
<a href="#">
Link <ArrowRightIcon />
</a>
</Badge>
<Badge asChild variant="outline">
<a href="#">
Link <ArrowRightIcon />
</a>
</Badge>
</div>
</div>
)
}

View File

@@ -0,0 +1,49 @@
import {
Breadcrumb,
BreadcrumbEllipsis,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from "@/registry/new-york-v4/ui/breadcrumb"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/registry/new-york-v4/ui/dropdown-menu"
export function BreadcrumbDemo() {
return (
<Breadcrumb>
<BreadcrumbList>
<BreadcrumbItem>
<BreadcrumbLink href="/">Home</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<DropdownMenu>
<DropdownMenuTrigger className="flex items-center gap-1">
<BreadcrumbEllipsis className="h-4 w-4" />
<span className="sr-only">Toggle menu</span>
</DropdownMenuTrigger>
<DropdownMenuContent align="start">
<DropdownMenuItem>Documentation</DropdownMenuItem>
<DropdownMenuItem>Themes</DropdownMenuItem>
<DropdownMenuItem>GitHub</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbLink href="/docs/components">Components</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbPage>Breadcrumb</BreadcrumbPage>
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
)
}

View File

@@ -0,0 +1,84 @@
import { ArrowRightIcon, Loader2Icon, SendIcon } from "lucide-react"
import { Button } from "@/registry/new-york-v4/ui/button"
export function ButtonDemo() {
return (
<div className="flex flex-col gap-6">
<div className="flex flex-col items-center gap-2 md:flex-row">
<Button>Button</Button>
<Button variant="outline">Outline</Button>
<Button variant="ghost">Ghost</Button>
<Button variant="destructive">Destructive</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="link">Link</Button>
<Button variant="outline">
<SendIcon /> Send
</Button>
<Button variant="outline">
Learn More <ArrowRightIcon />
</Button>
<Button disabled variant="outline">
<Loader2Icon className="animate-spin" />
Please wait
</Button>
</div>
<div className="flex flex-col items-center gap-2 md:flex-row">
<Button size="sm">Small</Button>
<Button variant="outline" size="sm">
Outline
</Button>
<Button variant="ghost" size="sm">
Ghost
</Button>
<Button variant="destructive" size="sm">
Destructive
</Button>
<Button variant="secondary" size="sm">
Secondary
</Button>
<Button variant="link" size="sm">
Link
</Button>
<Button variant="outline" size="sm">
<SendIcon /> Send
</Button>
<Button variant="outline" size="sm">
Learn More <ArrowRightIcon />
</Button>
<Button disabled size="sm" variant="outline">
<Loader2Icon className="animate-spin" />
Please wait
</Button>
</div>
<div className="flex flex-col flex-wrap items-center gap-2 md:flex-row">
<Button size="lg">Large</Button>
<Button variant="outline" size="lg">
Outline
</Button>
<Button variant="ghost" size="lg">
Ghost
</Button>
<Button variant="destructive" size="lg">
Destructive
</Button>
<Button variant="secondary" size="lg">
Secondary
</Button>
<Button variant="link" size="lg">
Link
</Button>
<Button variant="outline" size="lg">
<SendIcon /> Send
</Button>
<Button variant="outline" size="lg">
Learn More <ArrowRightIcon />
</Button>
<Button disabled size="lg" variant="outline">
<Loader2Icon className="animate-spin" />
Please wait
</Button>
</div>
</div>
)
}

View File

@@ -0,0 +1,35 @@
"use client"
import * as React from "react"
import { addDays } from "date-fns"
import { type DateRange } from "react-day-picker"
import { Calendar } from "@/registry/new-york-v4/ui/calendar"
export function CalendarDemo() {
const [date, setDate] = React.useState<Date | undefined>(new Date())
const [dateRange, setDateRange] = React.useState<DateRange | undefined>({
from: new Date(new Date().getFullYear(), 0, 12),
to: addDays(new Date(new Date().getFullYear(), 0, 12), 30),
})
return (
<div className="flex flex-col items-start gap-2 md:flex-row">
<Calendar
mode="single"
selected={date}
onSelect={setDate}
className="rounded-md border shadow-sm"
/>
<Calendar
mode="range"
defaultMonth={dateRange?.from}
selected={dateRange}
onSelect={setDateRange}
numberOfMonths={2}
disabled={(date) => date > new Date() || date < new Date("1900-01-01")}
className="rounded-md border shadow-sm"
/>
</div>
)
}

View File

@@ -0,0 +1,143 @@
import Image from "next/image"
import { BathIcon, BedIcon, LandPlotIcon } from "lucide-react"
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/registry/new-york-v4/ui/avatar"
import { Badge } from "@/registry/new-york-v4/ui/badge"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/registry/new-york-v4/ui/card"
import { Input } from "@/registry/new-york-v4/ui/input"
import { Label } from "@/registry/new-york-v4/ui/label"
export function CardDemo() {
return (
<div className="flex flex-col items-start gap-4">
<Card>
<form>
<CardHeader>
<CardTitle>Login to your account</CardTitle>
<CardDescription>
Enter your email below to login to your account
</CardDescription>
</CardHeader>
<CardContent>
<div className="flex flex-col gap-6">
<div className="grid gap-2">
<Label htmlFor="email">Email</Label>
<Input
id="email"
type="email"
placeholder="m@example.com"
required
/>
</div>
<div className="grid gap-2">
<div className="flex items-center">
<Label htmlFor="password">Password</Label>
<a
href="#"
className="ml-auto inline-block text-sm underline-offset-4 hover:underline"
>
Forgot your password?
</a>
</div>
<Input id="password" type="password" required />
</div>
</div>
</CardContent>
<CardFooter className="flex-col gap-2">
<Button type="submit" className="w-full">
Login
</Button>
<Button variant="outline" className="w-full">
Login with Google
</Button>
<div className="mt-4 text-center text-sm">
Don&apos;t have an account?{" "}
<a href="#" className="underline underline-offset-4">
Sign up
</a>
</div>
</CardFooter>
</form>
</Card>
<Card>
<CardHeader>
<CardTitle>Meeting Notes</CardTitle>
<CardDescription>
Transcript from the meeting with the client.
</CardDescription>
</CardHeader>
<CardContent className="text-sm">
<p>
Client requested dashboard redesign with focus on mobile
responsiveness.
</p>
<ol className="mt-4 flex list-decimal flex-col gap-2 pl-6">
<li>New analytics widgets for daily/weekly metrics</li>
<li>Simplified navigation menu</li>
<li>Dark mode support</li>
<li>Timeline: 6 weeks</li>
<li>Follow-up meeting scheduled for next Tuesday</li>
</ol>
</CardContent>
<CardFooter>
<div className="*:data-[slot=avatar]:ring-background flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:grayscale">
<Avatar>
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
<AvatarFallback>CN</AvatarFallback>
</Avatar>
<Avatar>
<AvatarImage src="https://github.com/leerob.png" alt="@leerob" />
<AvatarFallback>LR</AvatarFallback>
</Avatar>
<Avatar>
<AvatarImage
src="https://github.com/evilrabbit.png"
alt="@evilrabbit"
/>
<AvatarFallback>ER</AvatarFallback>
</Avatar>
</div>
</CardFooter>
</Card>
<Card>
<CardHeader>
<CardTitle>Is this an image?</CardTitle>
<CardDescription>This is a card with an image.</CardDescription>
</CardHeader>
<CardContent className="p-0">
<Image
src="https://images.unsplash.com/photo-1588345921523-c2dcdb7f1dcd?w=800&dpr=2&q=80"
alt="Photo by Drew Beamer"
className="aspect-video object-cover"
width={500}
height={500}
/>
</CardContent>
<CardFooter className="flex items-center gap-2 p-6">
<Badge variant="outline">
<BedIcon /> 4
</Badge>
<Badge variant="outline">
<BathIcon /> 2
</Badge>
<Badge variant="outline">
<LandPlotIcon /> 350m²
</Badge>
<div className="ml-auto font-medium tabular-nums">$135,000</div>
</CardFooter>
</Card>
</div>
)
}

View File

@@ -0,0 +1,74 @@
import * as React from "react"
import { Card, CardContent } from "@/registry/new-york-v4/ui/card"
import {
Carousel,
CarouselContent,
CarouselItem,
CarouselNext,
CarouselPrevious,
} from "@/registry/new-york-v4/ui/carousel"
export function CarouselDemo() {
return (
<div className="w-full flex-col items-center gap-4 md:flex">
<Carousel className="max-w-sm *:data-[slot=carousel-next]:hidden *:data-[slot=carousel-previous]:hidden *:data-[slot=carousel-next]:md:inline-flex *:data-[slot=carousel-previous]:md:inline-flex">
<CarouselContent>
{Array.from({ length: 5 }).map((_, index) => (
<CarouselItem key={index}>
<div className="p-1">
<Card>
<CardContent className="flex aspect-square items-center justify-center p-6">
<span className="text-4xl font-semibold">{index + 1}</span>
</CardContent>
</Card>
</div>
</CarouselItem>
))}
</CarouselContent>
<CarouselPrevious />
<CarouselNext />
</Carousel>
<Carousel
className="max-w-sm *:data-[slot=carousel-next]:hidden *:data-[slot=carousel-previous]:hidden *:data-[slot=carousel-next]:md:inline-flex *:data-[slot=carousel-previous]:md:inline-flex"
opts={{
align: "start",
}}
>
<CarouselContent>
{Array.from({ length: 5 }).map((_, index) => (
<CarouselItem key={index} className="md:basis-1/2 lg:basis-1/3">
<div className="p-1">
<Card>
<CardContent className="flex aspect-square items-center justify-center p-6">
<span className="text-3xl font-semibold">{index + 1}</span>
</CardContent>
</Card>
</div>
</CarouselItem>
))}
</CarouselContent>
<CarouselPrevious />
<CarouselNext />
</Carousel>
<Carousel className="max-w-sm *:data-[slot=carousel-next]:hidden *:data-[slot=carousel-previous]:hidden *:data-[slot=carousel-next]:md:inline-flex *:data-[slot=carousel-previous]:md:inline-flex">
<CarouselContent className="-ml-1">
{Array.from({ length: 5 }).map((_, index) => (
<CarouselItem key={index} className="pl-1 md:basis-1/2">
<div className="p-1">
<Card>
<CardContent className="flex aspect-square items-center justify-center p-6">
<span className="text-2xl font-semibold">{index + 1}</span>
</CardContent>
</Card>
</div>
</CarouselItem>
))}
</CarouselContent>
<CarouselPrevious />
<CarouselNext />
</Carousel>
</div>
)
}

View File

@@ -0,0 +1,94 @@
"use client"
import { TrendingUp } from "lucide-react"
import { Area, AreaChart, CartesianGrid, XAxis } from "recharts"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/registry/new-york-v4/ui/card"
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from "@/registry/new-york-v4/ui/chart"
export const description = "A simple area chart"
const chartData = [
{ month: "January", desktop: 186 },
{ month: "February", desktop: 305 },
{ month: "March", desktop: 237 },
{ month: "April", desktop: 73 },
{ month: "May", desktop: 209 },
{ month: "June", desktop: 214 },
]
const chartConfig = {
desktop: {
label: "Desktop",
color: "var(--chart-1)",
},
} satisfies ChartConfig
export function ChartAreaDemo() {
return (
<Card>
<CardHeader>
<CardTitle>Area Chart</CardTitle>
<CardDescription>
Showing total visitors for the last 6 months
</CardDescription>
</CardHeader>
<CardContent>
<ChartContainer config={chartConfig}>
<AreaChart
accessibilityLayer
data={chartData}
margin={{
left: 12,
right: 12,
}}
>
<CartesianGrid vertical={false} />
<XAxis
dataKey="month"
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)}
/>
<ChartTooltip
cursor={false}
content={<ChartTooltipContent indicator="line" />}
/>
<Area
dataKey="desktop"
type="natural"
fill="var(--color-desktop)"
fillOpacity={0.4}
stroke="var(--color-desktop)"
/>
</AreaChart>
</ChartContainer>
</CardContent>
<CardFooter>
<div className="flex w-full items-start gap-2 text-sm">
<div className="grid gap-2">
<div className="flex items-center gap-2 leading-none font-medium">
Trending up by 5.2% this month <TrendingUp className="h-4 w-4" />
</div>
<div className="text-muted-foreground flex items-center gap-2 leading-none">
January - June 2024
</div>
</div>
</div>
</CardFooter>
</Card>
)
}

View File

@@ -0,0 +1,80 @@
"use client"
import { TrendingUp } from "lucide-react"
import { Bar, BarChart, CartesianGrid, XAxis } from "recharts"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/registry/new-york-v4/ui/card"
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from "@/registry/new-york-v4/ui/chart"
export const description = "A multiple bar chart"
const chartData = [
{ month: "January", desktop: 186, mobile: 80 },
{ month: "February", desktop: 305, mobile: 200 },
{ month: "March", desktop: 237, mobile: 120 },
{ month: "April", desktop: 73, mobile: 190 },
{ month: "May", desktop: 209, mobile: 130 },
{ month: "June", desktop: 214, mobile: 140 },
]
const chartConfig = {
desktop: {
label: "Desktop",
color: "var(--chart-1)",
},
mobile: {
label: "Mobile",
color: "var(--chart-2)",
},
} satisfies ChartConfig
export function ChartBarDemo() {
return (
<Card>
<CardHeader>
<CardTitle>Bar Chart - Multiple</CardTitle>
<CardDescription>January - June 2024</CardDescription>
</CardHeader>
<CardContent>
<ChartContainer config={chartConfig}>
<BarChart accessibilityLayer data={chartData}>
<CartesianGrid vertical={false} />
<XAxis
dataKey="month"
tickLine={false}
tickMargin={10}
axisLine={false}
tickFormatter={(value) => value.slice(0, 3)}
/>
<ChartTooltip
cursor={false}
content={<ChartTooltipContent indicator="dashed" />}
/>
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
</BarChart>
</ChartContainer>
</CardContent>
<CardFooter className="flex-col items-start gap-2 text-sm">
<div className="flex gap-2 leading-none font-medium">
Trending up by 5.2% this month <TrendingUp className="h-4 w-4" />
</div>
<div className="text-muted-foreground leading-none">
Showing total visitors for the last 6 months
</div>
</CardFooter>
</Card>
)
}

View File

@@ -0,0 +1,13 @@
import { ChartAreaDemo } from "@/components/chart-area-demo"
import { ChartBarDemo } from "@/components/chart-bar-demo"
import { ChartLineDemo } from "@/components/chart-line-demo"
export function ChartDemo() {
return (
<div className="flex w-full max-w-screen-xl flex-col flex-wrap gap-4 *:data-[slot=card]:flex-1 md:flex-row">
<ChartAreaDemo />
<ChartBarDemo />
<ChartLineDemo />
</div>
)
}

View File

@@ -0,0 +1,100 @@
"use client"
import { TrendingUp } from "lucide-react"
import { CartesianGrid, Line, LineChart, XAxis } from "recharts"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/registry/new-york-v4/ui/card"
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from "@/registry/new-york-v4/ui/chart"
export const description = "A multiple line chart"
const chartData = [
{ month: "January", desktop: 186, mobile: 80 },
{ month: "February", desktop: 305, mobile: 200 },
{ month: "March", desktop: 237, mobile: 120 },
{ month: "April", desktop: 73, mobile: 190 },
{ month: "May", desktop: 209, mobile: 130 },
{ month: "June", desktop: 214, mobile: 140 },
]
const chartConfig = {
desktop: {
label: "Desktop",
color: "var(--chart-1)",
},
mobile: {
label: "Mobile",
color: "var(--chart-2)",
},
} satisfies ChartConfig
export function ChartLineDemo() {
return (
<Card>
<CardHeader>
<CardTitle>Line Chart - Multiple</CardTitle>
<CardDescription>January - June 2024</CardDescription>
</CardHeader>
<CardContent>
<ChartContainer config={chartConfig}>
<LineChart
accessibilityLayer
data={chartData}
margin={{
left: 12,
right: 12,
}}
>
<CartesianGrid vertical={false} />
<XAxis
dataKey="month"
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)}
/>
<ChartTooltip cursor={false} content={<ChartTooltipContent />} />
<Line
dataKey="desktop"
type="monotone"
stroke="var(--color-desktop)"
strokeWidth={2}
dot={false}
/>
<Line
dataKey="mobile"
type="monotone"
stroke="var(--color-mobile)"
strokeWidth={2}
dot={false}
/>
</LineChart>
</ChartContainer>
</CardContent>
<CardFooter>
<div className="flex w-full items-start gap-2 text-sm">
<div className="grid gap-2">
<div className="flex items-center gap-2 leading-none font-medium">
Trending up by 5.2% this month <TrendingUp className="h-4 w-4" />
</div>
<div className="text-muted-foreground flex items-center gap-2 leading-none">
Showing total visitors for the last 6 months
</div>
</div>
</div>
</CardFooter>
</Card>
)
}

View File

@@ -0,0 +1,43 @@
"use client"
import { Checkbox } from "@/registry/new-york-v4/ui/checkbox"
import { Label } from "@/registry/new-york-v4/ui/label"
export function CheckboxDemo() {
return (
<div className="flex flex-col gap-6">
<div className="flex items-center gap-3">
<Checkbox id="terms" />
<Label htmlFor="terms">Accept terms and conditions</Label>
</div>
<div className="flex items-start gap-3">
<Checkbox id="terms-2" defaultChecked />
<div className="grid gap-2">
<Label htmlFor="terms-2">Accept terms and conditions</Label>
<p className="text-muted-foreground text-sm">
By clicking this checkbox, you agree to the terms and conditions.
</p>
</div>
</div>
<div className="flex items-start gap-3">
<Checkbox id="toggle" disabled />
<Label htmlFor="toggle">Enable notifications</Label>
</div>
<Label className="hover:bg-accent/50 flex items-start gap-3 rounded-lg border p-3 has-[[aria-checked=true]]:border-blue-600 has-[[aria-checked=true]]:bg-blue-50 dark:has-[[aria-checked=true]]:border-blue-900 dark:has-[[aria-checked=true]]:bg-blue-950">
<Checkbox
id="toggle-2"
defaultChecked
className="data-[state=checked]:border-blue-600 data-[state=checked]:bg-blue-600 data-[state=checked]:text-white dark:data-[state=checked]:border-blue-700 dark:data-[state=checked]:bg-blue-700"
/>
<div className="grid gap-1.5 font-normal">
<p className="text-sm leading-none font-medium">
Enable notifications
</p>
<p className="text-muted-foreground text-sm">
You can enable or disable notifications at any time.
</p>
</div>
</Label>
</div>
)
}

View File

@@ -0,0 +1,46 @@
"use client"
import * as React from "react"
import { ChevronsUpDown } from "lucide-react"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
} from "@/registry/new-york-v4/ui/collapsible"
export function CollapsibleDemo() {
const [isOpen, setIsOpen] = React.useState(false)
return (
<Collapsible
open={isOpen}
onOpenChange={setIsOpen}
className="flex w-full flex-col gap-2 md:w-[350px]"
>
<div className="flex items-center justify-between gap-4 px-4">
<h4 className="line-clamp-1 text-sm font-semibold">
@peduarte starred 3 repositories
</h4>
<CollapsibleTrigger asChild>
<Button variant="ghost" size="sm">
<ChevronsUpDown className="h-4 w-4" />
<span className="sr-only">Toggle</span>
</Button>
</CollapsibleTrigger>
</div>
<div className="rounded-md border px-4 py-2 font-mono text-sm shadow-xs">
@radix-ui/primitives
</div>
<CollapsibleContent className="flex flex-col gap-2">
<div className="rounded-md border px-4 py-2 font-mono text-sm shadow-xs">
@radix-ui/colors
</div>
<div className="rounded-md border px-4 py-2 font-mono text-sm shadow-xs">
@stitches/react
</div>
</CollapsibleContent>
</Collapsible>
)
}

View File

@@ -0,0 +1,344 @@
"use client"
import * as React from "react"
import {
CheckIcon,
ChevronDownIcon,
ChevronsUpDown,
PlusCircleIcon,
} from "lucide-react"
import { cn } from "@/lib/utils"
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/registry/new-york-v4/ui/avatar"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandSeparator,
} from "@/registry/new-york-v4/ui/command"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/registry/new-york-v4/ui/popover"
const frameworks = [
{
value: "next.js",
label: "Next.js",
},
{
value: "sveltekit",
label: "SvelteKit",
},
{
value: "nuxt.js",
label: "Nuxt.js",
},
{
value: "remix",
label: "Remix",
},
{
value: "astro",
label: "Astro",
},
]
type Framework = (typeof frameworks)[number]
const users = [
{
id: "1",
username: "shadcn",
},
{
id: "2",
username: "leerob",
},
{
id: "3",
username: "evilrabbit",
},
] as const
type User = (typeof users)[number]
const timezones = [
{
label: "Americas",
timezones: [
{ value: "America/New_York", label: "(GMT-5) New York" },
{ value: "America/Los_Angeles", label: "(GMT-8) Los Angeles" },
{ value: "America/Chicago", label: "(GMT-6) Chicago" },
{ value: "America/Toronto", label: "(GMT-5) Toronto" },
{ value: "America/Vancouver", label: "(GMT-8) Vancouver" },
{ value: "America/Sao_Paulo", label: "(GMT-3) São Paulo" },
],
},
{
label: "Europe",
timezones: [
{ value: "Europe/London", label: "(GMT+0) London" },
{ value: "Europe/Paris", label: "(GMT+1) Paris" },
{ value: "Europe/Berlin", label: "(GMT+1) Berlin" },
{ value: "Europe/Rome", label: "(GMT+1) Rome" },
{ value: "Europe/Madrid", label: "(GMT+1) Madrid" },
{ value: "Europe/Amsterdam", label: "(GMT+1) Amsterdam" },
],
},
{
label: "Asia/Pacific",
timezones: [
{ value: "Asia/Tokyo", label: "(GMT+9) Tokyo" },
{ value: "Asia/Shanghai", label: "(GMT+8) Shanghai" },
{ value: "Asia/Singapore", label: "(GMT+8) Singapore" },
{ value: "Asia/Dubai", label: "(GMT+4) Dubai" },
{ value: "Australia/Sydney", label: "(GMT+11) Sydney" },
{ value: "Asia/Seoul", label: "(GMT+9) Seoul" },
],
},
] as const
type Timezone = (typeof timezones)[number]
export function ComboboxDemo() {
return (
<div className="flex w-full flex-col items-start gap-4 md:flex-row">
<FrameworkCombobox frameworks={[...frameworks]} />
<UserCombobox users={[...users]} selectedUserId={users[0].id} />
<TimezoneCombobox
timezones={[...timezones]}
selectedTimezone={timezones[0].timezones[0]}
/>
</div>
)
}
function FrameworkCombobox({ frameworks }: { frameworks: Framework[] }) {
const [open, setOpen] = React.useState(false)
const [value, setValue] = React.useState("")
return (
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Button
variant="outline"
role="combobox"
aria-expanded={open}
className="w-full justify-between md:max-w-[200px]"
>
{value
? frameworks.find((framework) => framework.value === value)?.label
: "Select framework..."}
<ChevronsUpDown className="text-muted-foreground" />
</Button>
</PopoverTrigger>
<PopoverContent className="w-(--radix-popover-trigger-width) p-0">
<Command>
<CommandInput placeholder="Search framework..." />
<CommandList>
<CommandEmpty>No framework found.</CommandEmpty>
<CommandGroup>
{frameworks.map((framework) => (
<CommandItem
key={framework.value}
value={framework.value}
onSelect={(currentValue) => {
setValue(currentValue === value ? "" : currentValue)
setOpen(false)
}}
>
{framework.label}
<CheckIcon
className={cn(
"ml-auto",
value === framework.value ? "opacity-100" : "opacity-0"
)}
/>
</CommandItem>
))}
</CommandGroup>
</CommandList>
</Command>
</PopoverContent>
</Popover>
)
}
function UserCombobox({
users,
selectedUserId,
}: {
users: User[]
selectedUserId: string
}) {
const [open, setOpen] = React.useState(false)
const [value, setValue] = React.useState(selectedUserId)
const selectedUser = React.useMemo(
() => users.find((user) => user.id === value),
[value, users]
)
return (
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Button
variant="outline"
role="combobox"
aria-expanded={open}
className="w-full justify-between px-2 md:max-w-[200px]"
>
{selectedUser ? (
<div className="flex items-center gap-2">
<Avatar className="size-5">
<AvatarImage
src={`https://github.com/${selectedUser.username}.png`}
/>
<AvatarFallback>{selectedUser.username[0]}</AvatarFallback>
</Avatar>
{selectedUser.username}
</div>
) : (
"Select user..."
)}
<ChevronsUpDown className="text-muted-foreground" />
</Button>
</PopoverTrigger>
<PopoverContent className="w-(--radix-popover-trigger-width) p-0">
<Command>
<CommandInput placeholder="Search user..." />
<CommandList>
<CommandEmpty>No user found.</CommandEmpty>
<CommandGroup>
{users.map((user) => (
<CommandItem
key={user.id}
value={user.id}
onSelect={(currentValue) => {
setValue(currentValue === value ? "" : currentValue)
setOpen(false)
}}
>
<Avatar className="size-5">
<AvatarImage
src={`https://github.com/${user.username}.png`}
/>
<AvatarFallback>{user.username[0]}</AvatarFallback>
</Avatar>
{user.username}
<CheckIcon
className={cn(
"ml-auto",
value === user.id ? "opacity-100" : "opacity-0"
)}
/>
</CommandItem>
))}
</CommandGroup>
<CommandSeparator />
<CommandGroup>
<CommandItem>
<PlusCircleIcon />
Create user
</CommandItem>
</CommandGroup>
</CommandList>
</Command>
</PopoverContent>
</Popover>
)
}
function TimezoneCombobox({
timezones,
selectedTimezone,
}: {
timezones: Timezone[]
selectedTimezone: Timezone["timezones"][number]
}) {
const [open, setOpen] = React.useState(false)
const [value, setValue] = React.useState(selectedTimezone.value)
const selectedGroup = React.useMemo(
() =>
timezones.find((group) =>
group.timezones.find((tz) => tz.value === value)
),
[value, timezones]
)
const selectedTimezoneLabel = React.useMemo(
() => selectedGroup?.timezones.find((tz) => tz.value === value)?.label,
[value, selectedGroup]
)
return (
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Button
variant="outline"
className="h-12 w-full justify-between px-2.5 md:max-w-[200px]"
>
{selectedTimezone ? (
<div className="flex flex-col items-start gap-0.5">
<span className="text-muted-foreground text-xs font-normal">
{selectedGroup?.label}
</span>
<span>{selectedTimezoneLabel}</span>
</div>
) : (
"Select timezone"
)}
<ChevronDownIcon className="text-muted-foreground" />
</Button>
</PopoverTrigger>
<PopoverContent className="p-0" align="start">
<Command>
<CommandInput placeholder="Search timezone..." />
<CommandList className="scroll-pb-12">
<CommandEmpty>No timezone found.</CommandEmpty>
{timezones.map((region) => (
<CommandGroup key={region.label} heading={region.label}>
{region.timezones.map((timezone) => (
<CommandItem
key={timezone.value}
value={timezone.value}
onSelect={(currentValue) => {
setValue(
currentValue as Timezone["timezones"][number]["value"]
)
setOpen(false)
}}
>
{timezone.label}
<CheckIcon
className="ml-auto opacity-0 data-[selected=true]:opacity-100"
data-selected={value === timezone.value}
/>
</CommandItem>
))}
</CommandGroup>
))}
<CommandSeparator className="sticky bottom-10" />
<CommandGroup className="bg-popover sticky bottom-0">
<CommandItem>
<PlusCircleIcon />
Create timezone
</CommandItem>
</CommandGroup>
</CommandList>
</Command>
</PopoverContent>
</Popover>
)
}

View File

@@ -0,0 +1,87 @@
"use client"
import * as React from "react"
import {
Calculator,
Calendar,
CreditCard,
Settings,
Smile,
User,
} from "lucide-react"
import {
CommandDialog,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandSeparator,
CommandShortcut,
} from "@/registry/new-york-v4/ui/command"
export function CommandDemo() {
const [open, setOpen] = React.useState(false)
React.useEffect(() => {
const down = (e: KeyboardEvent) => {
if (e.key === "j" && (e.metaKey || e.ctrlKey)) {
e.preventDefault()
setOpen((open) => !open)
}
}
document.addEventListener("keydown", down)
return () => document.removeEventListener("keydown", down)
}, [])
return (
<>
<p className="text-muted-foreground text-sm">
Press{" "}
<kbd className="bg-muted text-muted-foreground pointer-events-none inline-flex h-5 items-center gap-1 rounded border px-1.5 font-mono text-[10px] font-medium opacity-100 select-none">
<span className="text-xs"></span>J
</kbd>
</p>
<CommandDialog open={open} onOpenChange={setOpen}>
<CommandInput placeholder="Type a command or search..." />
<CommandList>
<CommandEmpty>No results found.</CommandEmpty>
<CommandGroup heading="Suggestions">
<CommandItem>
<Calendar />
<span>Calendar</span>
</CommandItem>
<CommandItem>
<Smile />
<span>Search Emoji</span>
</CommandItem>
<CommandItem>
<Calculator />
<span>Calculator</span>
</CommandItem>
</CommandGroup>
<CommandSeparator />
<CommandGroup heading="Settings">
<CommandItem>
<User />
<span>Profile</span>
<CommandShortcut>P</CommandShortcut>
</CommandItem>
<CommandItem>
<CreditCard />
<span>Billing</span>
<CommandShortcut>B</CommandShortcut>
</CommandItem>
<CommandItem>
<Settings />
<span>Settings</span>
<CommandShortcut>S</CommandShortcut>
</CommandItem>
</CommandGroup>
</CommandList>
</CommandDialog>
</>
)
}

View File

@@ -0,0 +1,66 @@
"use client"
import * as React from "react"
import { cn } from "@/registry/new-york-v4/lib/utils"
export function ComponentWrapper({
className,
name,
children,
...props
}: React.ComponentPropsWithoutRef<"div"> & { name: string }) {
return (
<ComponentErrorBoundary name={name}>
<div
id={name}
data-name={name.toLowerCase()}
className={cn(
"flex w-full scroll-mt-16 flex-col rounded-lg border",
className
)}
{...props}
>
<div className="border-b px-4 py-3">
<div className="text-sm font-medium">{getComponentName(name)}</div>
</div>
<div className="flex flex-1 items-center gap-2 p-4">{children}</div>
</div>
</ComponentErrorBoundary>
)
}
class ComponentErrorBoundary extends React.Component<
{ children: React.ReactNode; name: string },
{ hasError: boolean }
> {
constructor(props: { children: React.ReactNode; name: string }) {
super(props)
this.state = { hasError: false }
}
static getDerivedStateFromError() {
return { hasError: true }
}
componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
console.error(`Error in component ${this.props.name}:`, error, errorInfo)
}
render() {
if (this.state.hasError) {
return (
<div className="p-4 text-red-500">
Something went wrong in component: {this.props.name}
</div>
)
}
return this.props.children
}
}
function getComponentName(name: string) {
// convert kebab-case to title case
return name.replace(/-/g, " ").replace(/\b\w/g, (char) => char.toUpperCase())
}

View File

@@ -0,0 +1,79 @@
import { Code2Icon, PlusIcon, TrashIcon } from "lucide-react"
import {
ContextMenu,
ContextMenuCheckboxItem,
ContextMenuContent,
ContextMenuItem,
ContextMenuLabel,
ContextMenuRadioGroup,
ContextMenuRadioItem,
ContextMenuSeparator,
ContextMenuShortcut,
ContextMenuSub,
ContextMenuSubContent,
ContextMenuSubTrigger,
ContextMenuTrigger,
} from "@/registry/new-york-v4/ui/context-menu"
export function ContextMenuDemo() {
return (
<ContextMenu>
<ContextMenuTrigger className="flex h-[150px] w-[300px] items-center justify-center rounded-md border border-dashed text-sm">
Right click here
</ContextMenuTrigger>
<ContextMenuContent className="w-64">
<ContextMenuItem inset>
Back
<ContextMenuShortcut>[</ContextMenuShortcut>
</ContextMenuItem>
<ContextMenuItem inset disabled>
Forward
<ContextMenuShortcut>]</ContextMenuShortcut>
</ContextMenuItem>
<ContextMenuItem inset>
Reload
<ContextMenuShortcut>R</ContextMenuShortcut>
</ContextMenuItem>
<ContextMenuSub>
<ContextMenuSubTrigger inset>More Tools</ContextMenuSubTrigger>
<ContextMenuSubContent className="w-48">
<ContextMenuItem inset>
Save Page As...
<ContextMenuShortcut>S</ContextMenuShortcut>
</ContextMenuItem>
<ContextMenuItem>
<PlusIcon />
Create Shortcut...
</ContextMenuItem>
<ContextMenuItem inset>Name Window...</ContextMenuItem>
<ContextMenuSeparator />
<ContextMenuItem>
<Code2Icon />
Developer Tools
</ContextMenuItem>
<ContextMenuSeparator />
<ContextMenuItem variant="destructive">
<TrashIcon />
Delete
</ContextMenuItem>
</ContextMenuSubContent>
</ContextMenuSub>
<ContextMenuSeparator />
<ContextMenuCheckboxItem checked>
Show Bookmarks Bar
<ContextMenuShortcut>B</ContextMenuShortcut>
</ContextMenuCheckboxItem>
<ContextMenuCheckboxItem>Show Full URLs</ContextMenuCheckboxItem>
<ContextMenuSeparator />
<ContextMenuRadioGroup value="pedro">
<ContextMenuLabel inset>People</ContextMenuLabel>
<ContextMenuRadioItem value="pedro">
Pedro Duarte
</ContextMenuRadioItem>
<ContextMenuRadioItem value="colm">Colm Tuite</ContextMenuRadioItem>
</ContextMenuRadioGroup>
</ContextMenuContent>
</ContextMenu>
)
}

View File

@@ -0,0 +1,99 @@
"use client"
import * as React from "react"
import { addDays, format } from "date-fns"
import { CalendarIcon } from "lucide-react"
import { DateRange } from "react-day-picker"
import { cn } from "@/lib/utils"
import { Button } from "@/registry/new-york-v4/ui/button"
import { Calendar } from "@/registry/new-york-v4/ui/calendar"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/registry/new-york-v4/ui/popover"
export function DatePickerDemo() {
return (
<div className="flex flex-col items-start gap-4 md:flex-row">
<DatePickerSimple />
<DatePickerWithRange />
</div>
)
}
function DatePickerSimple() {
const [date, setDate] = React.useState<Date>()
return (
<Popover>
<PopoverTrigger asChild>
<Button
variant={"outline"}
className={cn(
"min-w-[200px] justify-start px-2 font-normal",
!date && "text-muted-foreground"
)}
>
<CalendarIcon />
{date ? format(date, "PPP") : <span>Pick a date</span>}
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<Calendar
mode="single"
selected={date}
onSelect={setDate}
initialFocus
/>
</PopoverContent>
</Popover>
)
}
function DatePickerWithRange() {
const [date, setDate] = React.useState<DateRange | undefined>({
from: new Date(new Date().getFullYear(), 0, 20),
to: addDays(new Date(new Date().getFullYear(), 0, 20), 20),
})
return (
<Popover>
<PopoverTrigger asChild>
<Button
id="date"
variant={"outline"}
className={cn(
"w-fit justify-start px-2 font-normal",
!date && "text-muted-foreground"
)}
>
<CalendarIcon />
{date?.from ? (
date.to ? (
<>
{format(date.from, "LLL dd, y")} -{" "}
{format(date.to, "LLL dd, y")}
</>
) : (
format(date.from, "LLL dd, y")
)
) : (
<span>Pick a date</span>
)}
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<Calendar
initialFocus
mode="range"
defaultMonth={date?.from}
selected={date}
onSelect={setDate}
numberOfMonths={2}
/>
</PopoverContent>
</Popover>
)
}

View File

@@ -0,0 +1,129 @@
import { Button } from "@/registry/new-york-v4/ui/button"
import {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/registry/new-york-v4/ui/dialog"
import { Input } from "@/registry/new-york-v4/ui/input"
import { Label } from "@/registry/new-york-v4/ui/label"
export function DialogDemo() {
return (
<div className="flex flex-col items-start gap-4 md:flex-row">
<DialogWithForm />
<DialogScrollableContent />
<DialogWithStickyFooter />
</div>
)
}
function DialogWithForm() {
return (
<Dialog>
<form>
<DialogTrigger asChild>
<Button variant="outline">Edit Profile</Button>
</DialogTrigger>
<DialogContent className="sm:max-w-[425px]">
<DialogHeader>
<DialogTitle>Edit profile</DialogTitle>
<DialogDescription>
Make changes to your profile here. Click save when you&apos;re
done.
</DialogDescription>
</DialogHeader>
<div className="grid gap-4">
<div className="grid gap-3">
<Label htmlFor="name-1">Name</Label>
<Input id="name-1" name="name" defaultValue="Pedro Duarte" />
</div>
<div className="grid gap-3">
<Label htmlFor="username-1">Username</Label>
<Input id="username-1" name="username" defaultValue="@peduarte" />
</div>
</div>
<DialogFooter>
<DialogClose asChild>
<Button variant="outline">Cancel</Button>
</DialogClose>
<Button type="submit">Save changes</Button>
</DialogFooter>
</DialogContent>
</form>
</Dialog>
)
}
function DialogScrollableContent() {
return (
<Dialog>
<DialogTrigger asChild>
<Button variant="outline">Scrollable Content</Button>
</DialogTrigger>
<DialogContent className="sm:max-w-[425px]">
<DialogHeader>
<DialogTitle>Scrollable Content</DialogTitle>
<DialogDescription>
This is a dialog with scrollable content.
</DialogDescription>
</DialogHeader>
<div className="-mx-6 max-h-[500px] overflow-y-auto px-6 text-sm">
<h4 className="mb-4 text-lg leading-none font-medium">Lorem Ipsum</h4>
{Array.from({ length: 10 }).map((_, index) => (
<p key={index} className="mb-4 leading-normal">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
))}
</div>
</DialogContent>
</Dialog>
)
}
function DialogWithStickyFooter() {
return (
<Dialog>
<DialogTrigger asChild>
<Button variant="outline">Sticky Footer</Button>
</DialogTrigger>
<DialogContent className="sm:max-w-lg">
<DialogHeader>
<DialogTitle>Scrollable Content</DialogTitle>
<DialogDescription>
This is a dialog with scrollable content.
</DialogDescription>
</DialogHeader>
<div className="-mx-6 max-h-[500px] overflow-y-auto px-6 text-sm">
<h4 className="mb-4 text-lg leading-none font-medium">Lorem Ipsum</h4>
{Array.from({ length: 10 }).map((_, index) => (
<p key={index} className="mb-4 leading-normal">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
))}
</div>
<DialogFooter>
<DialogClose asChild>
<Button variant="outline">Close</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>
)
}

View File

@@ -0,0 +1,228 @@
"use client"
import * as React from "react"
import { Minus, Plus } from "lucide-react"
import { Bar, BarChart, ResponsiveContainer } from "recharts"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
Drawer,
DrawerClose,
DrawerContent,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerTitle,
DrawerTrigger,
} from "@/registry/new-york-v4/ui/drawer"
const data = [
{
goal: 400,
},
{
goal: 300,
},
{
goal: 200,
},
{
goal: 300,
},
{
goal: 200,
},
{
goal: 278,
},
{
goal: 189,
},
{
goal: 239,
},
{
goal: 300,
},
{
goal: 200,
},
{
goal: 278,
},
{
goal: 189,
},
{
goal: 349,
},
]
export function DrawerDemo() {
return (
<div className="flex flex-col items-start gap-4 md:flex-row md:items-center">
<DrawerBottom />
<DrawerScrollableContent />
<DrawerDirections />
</div>
)
}
function DrawerBottom() {
const [goal, setGoal] = React.useState(350)
const onClick = React.useCallback((adjustment: number) => {
setGoal((prevGoal) => Math.max(200, Math.min(400, prevGoal + adjustment)))
}, [])
return (
<Drawer>
<DrawerTrigger asChild>
<Button variant="outline">Open Drawer</Button>
</DrawerTrigger>
<DrawerContent>
<div className="mx-auto w-full max-w-sm">
<DrawerHeader>
<DrawerTitle>Move Goal</DrawerTitle>
<DrawerDescription>Set your daily activity goal.</DrawerDescription>
</DrawerHeader>
<div className="p-4 pb-0">
<div className="flex items-center justify-center space-x-2">
<Button
variant="outline"
size="icon"
className="h-8 w-8 shrink-0 rounded-full"
onClick={() => onClick(-10)}
disabled={goal <= 200}
>
<Minus />
<span className="sr-only">Decrease</span>
</Button>
<div className="flex-1 text-center">
<div className="text-7xl font-bold tracking-tighter">
{goal}
</div>
<div className="text-muted-foreground text-[0.70rem] uppercase">
Calories/day
</div>
</div>
<Button
variant="outline"
size="icon"
className="h-8 w-8 shrink-0 rounded-full"
onClick={() => onClick(10)}
disabled={goal >= 400}
>
<Plus />
<span className="sr-only">Increase</span>
</Button>
</div>
<div className="mt-3 h-[120px]">
<ResponsiveContainer width="100%" height="100%">
<BarChart data={data}>
<Bar
dataKey="goal"
style={
{
fill: "hsl(var(--foreground))",
opacity: 0.9,
} as React.CSSProperties
}
/>
</BarChart>
</ResponsiveContainer>
</div>
</div>
<DrawerFooter>
<Button>Submit</Button>
<DrawerClose asChild>
<Button variant="outline">Cancel</Button>
</DrawerClose>
</DrawerFooter>
</div>
</DrawerContent>
</Drawer>
)
}
function DrawerScrollableContent() {
return (
<Drawer direction="right">
<DrawerTrigger asChild>
<Button variant="outline">Scrollable Content</Button>
</DrawerTrigger>
<DrawerContent>
<DrawerHeader>
<DrawerTitle>Move Goal</DrawerTitle>
<DrawerDescription>Set your daily activity goal.</DrawerDescription>
</DrawerHeader>
<div className="overflow-y-auto px-4 text-sm">
<h4 className="mb-4 text-lg leading-none font-medium">Lorem Ipsum</h4>
{Array.from({ length: 10 }).map((_, index) => (
<p key={index} className="mb-4 leading-normal">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
))}
</div>
<DrawerFooter>
<Button>Submit</Button>
<DrawerClose asChild>
<Button variant="outline">Cancel</Button>
</DrawerClose>
</DrawerFooter>
</DrawerContent>
</Drawer>
)
}
const directions = ["top", "right", "bottom", "left"] as const
function DrawerDirections() {
return (
<>
{directions.map((direction) => (
<Drawer key={direction} direction={direction}>
<DrawerTrigger asChild>
<Button variant="outline" className="capitalize">
{direction}
</Button>
</DrawerTrigger>
<DrawerContent>
<DrawerHeader>
<DrawerTitle>Move Goal</DrawerTitle>
<DrawerDescription>
Set your daily activity goal.
</DrawerDescription>
</DrawerHeader>
<div className="overflow-y-auto px-4 text-sm">
{Array.from({ length: 10 }).map((_, index) => (
<p key={index} className="mb-4 leading-normal">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed
do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum
dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
</p>
))}
</div>
<DrawerFooter>
<Button>Submit</Button>
<DrawerClose asChild>
<Button variant="outline">Cancel</Button>
</DrawerClose>
</DrawerFooter>
</DrawerContent>
</Drawer>
))}
</>
)
}

View File

@@ -0,0 +1,360 @@
"use client"
import * as React from "react"
import {
BadgeCheckIcon,
BellIcon,
ChevronsUpDownIcon,
CreditCardIcon,
LogOut,
LogOutIcon,
MoreHorizontalIcon,
PencilIcon,
Settings2Icon,
ShareIcon,
SparklesIcon,
TrashIcon,
UserIcon,
} from "lucide-react"
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/registry/new-york-v4/ui/avatar"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
DropdownMenu,
DropdownMenuCheckboxItem,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuPortal,
DropdownMenuRadioGroup,
DropdownMenuRadioItem,
DropdownMenuSeparator,
DropdownMenuShortcut,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
DropdownMenuTrigger,
} from "@/registry/new-york-v4/ui/dropdown-menu"
export function DropdownMenuDemo() {
return (
<div className="flex flex-col items-center gap-4 md:flex-row">
<DropdownMenuSimple />
<DropdownMenuCheckboxes />
<DropdownMenuRadioGroupDemo />
<DropdownMenuWithAvatar />
<DropdownMenuAvatarOnly />
<DropdownMenuIconColor />
</div>
)
}
function DropdownMenuSimple() {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline">Open</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" className="w-56">
<DropdownMenuLabel>My Account</DropdownMenuLabel>
<DropdownMenuGroup>
<DropdownMenuItem>
Profile
<DropdownMenuShortcut>P</DropdownMenuShortcut>
</DropdownMenuItem>
<DropdownMenuItem>
Billing
<DropdownMenuShortcut>B</DropdownMenuShortcut>
</DropdownMenuItem>
<DropdownMenuItem>
Settings
<DropdownMenuShortcut>S</DropdownMenuShortcut>
</DropdownMenuItem>
<DropdownMenuItem>
Keyboard shortcuts
<DropdownMenuShortcut>K</DropdownMenuShortcut>
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem>Team</DropdownMenuItem>
<DropdownMenuSub>
<DropdownMenuSubTrigger>Invite users</DropdownMenuSubTrigger>
<DropdownMenuPortal>
<DropdownMenuSubContent>
<DropdownMenuItem>Email</DropdownMenuItem>
<DropdownMenuItem>Message</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem>More...</DropdownMenuItem>
</DropdownMenuSubContent>
</DropdownMenuPortal>
</DropdownMenuSub>
<DropdownMenuItem>
New Team
<DropdownMenuShortcut>+T</DropdownMenuShortcut>
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuItem>GitHub</DropdownMenuItem>
<DropdownMenuItem>Support</DropdownMenuItem>
<DropdownMenuItem disabled>API</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem>
Log out
<DropdownMenuShortcut>Q</DropdownMenuShortcut>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
)
}
function DropdownMenuCheckboxes() {
const [showStatusBar, setShowStatusBar] = React.useState(true)
const [showActivityBar, setShowActivityBar] = React.useState(false)
const [showPanel, setShowPanel] = React.useState(false)
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline">Checkboxes</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" className="w-56">
<DropdownMenuGroup>
<DropdownMenuLabel>Account</DropdownMenuLabel>
<DropdownMenuItem>
<UserIcon /> Profile
</DropdownMenuItem>
<DropdownMenuItem>
<CreditCardIcon /> Billing
</DropdownMenuItem>
<DropdownMenuItem>
<Settings2Icon /> Settings
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuLabel>Appearance</DropdownMenuLabel>
<DropdownMenuCheckboxItem
checked={showStatusBar}
onCheckedChange={setShowStatusBar}
>
Status Bar
</DropdownMenuCheckboxItem>
<DropdownMenuCheckboxItem
checked={showActivityBar}
onCheckedChange={setShowActivityBar}
disabled
>
Activity Bar
</DropdownMenuCheckboxItem>
<DropdownMenuCheckboxItem
checked={showPanel}
onCheckedChange={setShowPanel}
>
Panel
</DropdownMenuCheckboxItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem>
<LogOutIcon /> Sign Out
</DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
)
}
function DropdownMenuRadioGroupDemo() {
const [position, setPosition] = React.useState("bottom")
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline">Radio Group</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" className="w-56">
<DropdownMenuLabel inset>Panel Position</DropdownMenuLabel>
<DropdownMenuGroup>
<DropdownMenuRadioGroup value={position} onValueChange={setPosition}>
<DropdownMenuRadioItem value="top">Top</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="bottom">Bottom</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="right" disabled>
Right
</DropdownMenuRadioItem>
</DropdownMenuRadioGroup>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
)
}
function DropdownMenuWithAvatar() {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
variant="outline"
className="h-12 justify-start px-2 md:max-w-[200px]"
>
<Avatar>
<AvatarImage src="https://github.com/shadcn.png" alt="Shadcn" />
<AvatarFallback className="rounded-lg">CN</AvatarFallback>
</Avatar>
<div className="grid flex-1 text-left text-sm leading-tight">
<span className="truncate font-semibold">shadcn</span>
<span className="text-muted-foreground truncate text-xs">
shadcn@example.com
</span>
</div>
<ChevronsUpDownIcon className="text-muted-foreground ml-auto" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent
className="w-(--radix-dropdown-menu-trigger-width) min-w-56"
align="start"
>
<DropdownMenuLabel className="p-0 font-normal">
<div className="flex items-center gap-2 px-1 py-1.5 text-left text-sm">
<Avatar>
<AvatarImage src="https://github.com/shadcn.png" alt="Shadcn" />
<AvatarFallback className="rounded-lg">CN</AvatarFallback>
</Avatar>
<div className="grid flex-1 text-left text-sm leading-tight">
<span className="truncate font-semibold">shadcn</span>
<span className="text-muted-foreground truncate text-xs">
shadcn@example.com
</span>
</div>
</div>
</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem>
<SparklesIcon />
Upgrade to Pro
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem>
<BadgeCheckIcon />
Account
</DropdownMenuItem>
<DropdownMenuItem>
<CreditCardIcon />
Billing
</DropdownMenuItem>
<DropdownMenuItem>
<BellIcon />
Notifications
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuItem>
<LogOut />
Sign Out
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
)
}
function DropdownMenuAvatarOnly() {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
variant="outline"
className="size-8 rounded-full border-none p-0"
>
<Avatar>
<AvatarImage src="https://github.com/leerob.png" alt="leerob" />
<AvatarFallback className="rounded-lg">LR</AvatarFallback>
</Avatar>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent
className="w-(--radix-dropdown-menu-trigger-width) min-w-56"
align="start"
>
<DropdownMenuLabel className="p-0 font-normal">
<div className="flex items-center gap-2 px-1 py-1.5 text-left text-sm">
<Avatar>
<AvatarImage src="https://github.com/leerob.png" alt="leerob" />
<AvatarFallback className="rounded-lg">LR</AvatarFallback>
</Avatar>
<div className="grid flex-1 text-left text-sm leading-tight">
<span className="truncate font-semibold">leerob</span>
<span className="text-muted-foreground truncate text-xs">
leerob@example.com
</span>
</div>
</div>
</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem>
<SparklesIcon />
Upgrade to Pro
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem>
<BadgeCheckIcon />
Account
</DropdownMenuItem>
<DropdownMenuItem>
<CreditCardIcon />
Billing
</DropdownMenuItem>
<DropdownMenuItem>
<BellIcon />
Notifications
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuItem>
<LogOut />
Sign Out
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
)
}
function DropdownMenuIconColor() {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" size="icon">
<MoreHorizontalIcon />
<span className="sr-only">Toggle menu</span>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start">
<DropdownMenuGroup className="*:data-[slot=dropdown-menu-item]:[&>svg]:text-muted-foreground">
<DropdownMenuItem>
<PencilIcon />
Edit
</DropdownMenuItem>
<DropdownMenuItem>
<ShareIcon />
Share
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem variant="destructive">
<TrashIcon />
Delete
</DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
)
}

View File

@@ -0,0 +1,395 @@
"use client"
import Link from "next/link"
import { zodResolver } from "@hookform/resolvers/zod"
import { format } from "date-fns"
import { CalendarIcon } from "lucide-react"
import { useForm } from "react-hook-form"
import { toast } from "sonner"
import { z } from "zod"
import { cn } from "@/lib/utils"
import { Button } from "@/registry/new-york-v4/ui/button"
import { Calendar } from "@/registry/new-york-v4/ui/calendar"
import { Checkbox } from "@/registry/new-york-v4/ui/checkbox"
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "@/registry/new-york-v4/ui/form"
import { Input } from "@/registry/new-york-v4/ui/input"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/registry/new-york-v4/ui/popover"
import {
RadioGroup,
RadioGroupItem,
} from "@/registry/new-york-v4/ui/radio-group"
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/registry/new-york-v4/ui/select"
import { Switch } from "@/registry/new-york-v4/ui/switch"
import { Textarea } from "@/registry/new-york-v4/ui/textarea"
const items = [
{
id: "recents",
label: "Recents",
},
{
id: "home",
label: "Home",
},
{
id: "applications",
label: "Applications",
},
{
id: "desktop",
label: "Desktop",
},
{
id: "downloads",
label: "Downloads",
},
{
id: "documents",
label: "Documents",
},
] as const
const FormSchema = z.object({
username: z.string().min(2, {
message: "Username must be at least 2 characters.",
}),
bio: z
.string()
.min(10, {
message: "Bio must be at least 10 characters.",
})
.max(160, {
message: "Bio must not be longer than 30 characters.",
}),
email: z
.string({
required_error: "Please select an email to display.",
})
.email(),
type: z.enum(["all", "mentions", "none"], {
required_error: "You need to select a notification type.",
}),
mobile: z.boolean().default(false).optional(),
items: z.array(z.string()).refine((value) => value.some((item) => item), {
message: "You have to select at least one item.",
}),
dob: z.date({
required_error: "A date of birth is required.",
}),
marketing_emails: z.boolean().default(false).optional(),
security_emails: z.boolean(),
})
export function FormDemo() {
const form = useForm<z.infer<typeof FormSchema>>({
resolver: zodResolver(FormSchema),
defaultValues: {
username: "",
items: ["recents", "home"],
},
})
function onSubmit(data: z.infer<typeof FormSchema>) {
toast("You submitted the following values:", {
description: (
<pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
<code className="text-white">{JSON.stringify(data, null, 2)}</code>
</pre>
),
})
}
return (
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="grid w-full max-w-sm gap-6"
>
<FormField
control={form.control}
name="username"
render={({ field }) => (
<FormItem>
<FormLabel>Username</FormLabel>
<FormControl>
<Input placeholder="shadcn" {...field} />
</FormControl>
<FormDescription>
This is your public display name.
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="email"
render={({ field }) => (
<FormItem>
<FormLabel>Email</FormLabel>
<Select onValueChange={field.onChange} defaultValue={field.value}>
<FormControl>
<SelectTrigger>
<SelectValue placeholder="Select a verified email to display" />
</SelectTrigger>
</FormControl>
<SelectContent>
<SelectItem value="m@example.com">m@example.com</SelectItem>
<SelectItem value="m@google.com">m@google.com</SelectItem>
<SelectItem value="m@support.com">m@support.com</SelectItem>
</SelectContent>
</Select>
<FormDescription>
You can manage email addresses in your{" "}
<Link href="/examples/forms">email settings</Link>.
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="bio"
render={({ field }) => (
<FormItem>
<FormLabel>Bio</FormLabel>
<FormControl>
<Textarea
placeholder="Tell us a little bit about yourself"
className="resize-none"
{...field}
/>
</FormControl>
<FormDescription>
You can <span>@mention</span> other users and organizations.
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="type"
render={({ field }) => (
<FormItem className="space-y-3">
<FormLabel>Notify me about...</FormLabel>
<FormControl>
<RadioGroup
onValueChange={field.onChange}
defaultValue={field.value}
className="flex flex-col space-y-1"
>
<FormItem className="flex items-center space-y-0 space-x-3">
<FormControl>
<RadioGroupItem value="all" />
</FormControl>
<FormLabel className="font-normal">
All new messages
</FormLabel>
</FormItem>
<FormItem className="flex items-center space-y-0 space-x-3">
<FormControl>
<RadioGroupItem value="mentions" />
</FormControl>
<FormLabel className="font-normal">
Direct messages and mentions
</FormLabel>
</FormItem>
<FormItem className="flex items-center space-y-0 space-x-3">
<FormControl>
<RadioGroupItem value="none" />
</FormControl>
<FormLabel className="font-normal">Nothing</FormLabel>
</FormItem>
</RadioGroup>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="mobile"
render={({ field }) => (
<FormItem className="flex flex-row items-start space-y-0 space-x-3 rounded-md border p-4 shadow">
<FormControl>
<Checkbox
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl>
<div className="space-y-1 leading-none">
<FormLabel>
Use different settings for my mobile devices
</FormLabel>
<FormDescription>
You can manage your mobile notifications in the{" "}
<Link href="/examples/forms">mobile settings</Link> page.
</FormDescription>
</div>
</FormItem>
)}
/>
<FormField
control={form.control}
name="items"
render={() => (
<FormItem>
<div className="mb-4">
<FormLabel className="text-base">Sidebar</FormLabel>
<FormDescription>
Select the items you want to display in the sidebar.
</FormDescription>
</div>
{items.map((item) => (
<FormField
key={item.id}
control={form.control}
name="items"
render={({ field }) => {
return (
<FormItem
key={item.id}
className="flex flex-row items-start space-y-0 space-x-3"
>
<FormControl>
<Checkbox
checked={field.value?.includes(item.id)}
onCheckedChange={(checked) => {
return checked
? field.onChange([...field.value, item.id])
: field.onChange(
field.value?.filter(
(value) => value !== item.id
)
)
}}
/>
</FormControl>
<FormLabel className="text-sm font-normal">
{item.label}
</FormLabel>
</FormItem>
)
}}
/>
))}
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="dob"
render={({ field }) => (
<FormItem className="flex flex-col">
<FormLabel>Date of birth</FormLabel>
<Popover>
<PopoverTrigger asChild>
<FormControl>
<Button
variant={"outline"}
className={cn(
"w-[240px] pl-3 text-left font-normal",
!field.value && "text-muted-foreground"
)}
>
{field.value ? (
format(field.value, "PPP")
) : (
<span>Pick a date</span>
)}
<CalendarIcon className="ml-auto h-4 w-4 opacity-50" />
</Button>
</FormControl>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<Calendar
mode="single"
selected={field.value}
onSelect={field.onChange}
disabled={(date) =>
date > new Date() || date < new Date("1900-01-01")
}
initialFocus
/>
</PopoverContent>
</Popover>
<FormDescription>
Your date of birth is used to calculate your age.
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
<div>
<h3 className="mb-4 text-lg font-medium">Email Notifications</h3>
<div className="space-y-4">
<FormField
control={form.control}
name="marketing_emails"
render={({ field }) => (
<FormItem className="flex flex-row items-center justify-between rounded-lg border p-3 shadow-sm">
<div className="space-y-0.5">
<FormLabel>Marketing emails</FormLabel>
<FormDescription>
Receive emails about new products, features, and more.
</FormDescription>
</div>
<FormControl>
<Switch
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl>
</FormItem>
)}
/>
<FormField
control={form.control}
name="security_emails"
render={({ field }) => (
<FormItem className="flex flex-row items-center justify-between rounded-lg border p-3 shadow-sm">
<div className="space-y-0.5">
<FormLabel>Security emails</FormLabel>
<FormDescription>
Receive emails about your account security.
</FormDescription>
</div>
<FormControl>
<Switch
checked={field.value}
onCheckedChange={field.onChange}
disabled
aria-readonly
/>
</FormControl>
</FormItem>
)}
/>
</div>
</div>
<Button type="submit">Submit</Button>
</form>
</Form>
)
}

View File

@@ -0,0 +1,43 @@
import { CalendarIcon } from "lucide-react"
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/registry/new-york-v4/ui/avatar"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
HoverCard,
HoverCardContent,
HoverCardTrigger,
} from "@/registry/new-york-v4/ui/hover-card"
export function HoverCardDemo() {
return (
<HoverCard>
<HoverCardTrigger asChild>
<Button variant="link">@nextjs</Button>
</HoverCardTrigger>
<HoverCardContent className="w-80" side="right">
<div className="flex justify-between gap-4">
<Avatar>
<AvatarImage src="https://github.com/vercel.png" />
<AvatarFallback>VC</AvatarFallback>
</Avatar>
<div className="flex flex-col gap-1">
<h4 className="text-sm font-semibold">@nextjs</h4>
<p className="text-sm">
The React Framework created and maintained by @vercel.
</p>
<div className="mt-1 flex items-center gap-2">
<CalendarIcon className="text-muted-foreground size-4" />{" "}
<span className="text-muted-foreground text-xs">
Joined December 2021
</span>
</div>
</div>
</div>
</HoverCardContent>
</HoverCard>
)
}

View File

@@ -0,0 +1,23 @@
import { Input } from "@/registry/new-york-v4/ui/input"
export function InputDemo() {
return (
<div className="flex flex-col flex-wrap gap-4 md:flex-row">
<Input type="email" placeholder="Email" />
<Input type="text" placeholder="Error" aria-invalid="true" />
<Input type="password" placeholder="Password" />
<Input type="number" placeholder="Number" />
<Input type="file" placeholder="File" />
<Input type="tel" placeholder="Tel" />
<Input type="text" placeholder="Text" />
<Input type="url" placeholder="URL" />
<Input type="search" placeholder="Search" />
<Input type="date" placeholder="Date" />
<Input type="datetime-local" placeholder="Datetime Local" />
<Input type="month" placeholder="Month" />
<Input type="time" placeholder="Time" />
<Input type="week" placeholder="Week" />
<Input disabled placeholder="Disabled" />
</div>
)
}

View File

@@ -0,0 +1,109 @@
"use client"
import * as React from "react"
import { REGEXP_ONLY_DIGITS } from "input-otp"
import {
InputOTP,
InputOTPGroup,
InputOTPSeparator,
InputOTPSlot,
} from "@/registry/new-york-v4/ui/input-otp"
import { Label } from "@/registry/new-york-v4/ui/label"
export function InputOTPDemo() {
return (
<div className="flex flex-col flex-wrap gap-6 md:flex-row">
<InputOTPSimple />
<InputOTPPattern />
<InputOTPWithSeparator />
<InputOTPWithSpacing />
</div>
)
}
function InputOTPSimple() {
return (
<div className="grid gap-2">
<Label htmlFor="simple">Simple</Label>
<InputOTP id="simple" maxLength={6}>
<InputOTPGroup>
<InputOTPSlot index={0} />
<InputOTPSlot index={1} />
<InputOTPSlot index={2} />
</InputOTPGroup>
<InputOTPSeparator />
<InputOTPGroup>
<InputOTPSlot index={3} />
<InputOTPSlot index={4} />
<InputOTPSlot index={5} />
</InputOTPGroup>
</InputOTP>
</div>
)
}
function InputOTPPattern() {
return (
<div className="grid gap-2">
<Label htmlFor="digits-only">Digits Only</Label>
<InputOTP id="digits-only" maxLength={6} pattern={REGEXP_ONLY_DIGITS}>
<InputOTPGroup>
<InputOTPSlot index={0} />
<InputOTPSlot index={1} />
<InputOTPSlot index={2} />
<InputOTPSlot index={3} />
<InputOTPSlot index={4} />
<InputOTPSlot index={5} />
</InputOTPGroup>
</InputOTP>
</div>
)
}
function InputOTPWithSeparator() {
const [value, setValue] = React.useState("123456")
return (
<div className="grid gap-2">
<Label htmlFor="with-separator">With Separator</Label>
<InputOTP
id="with-separator"
maxLength={6}
value={value}
onChange={setValue}
>
<InputOTPGroup>
<InputOTPSlot index={0} />
<InputOTPSlot index={1} />
</InputOTPGroup>
<InputOTPSeparator />
<InputOTPGroup>
<InputOTPSlot index={2} />
<InputOTPSlot index={3} />
</InputOTPGroup>
<InputOTPSeparator />
<InputOTPGroup>
<InputOTPSlot index={4} />
<InputOTPSlot index={5} />
</InputOTPGroup>
</InputOTP>
</div>
)
}
function InputOTPWithSpacing() {
return (
<div className="grid gap-2">
<Label htmlFor="with-spacing">With Spacing</Label>
<InputOTP id="with-spacing" maxLength={6}>
<InputOTPGroup className="gap-2 *:data-[slot=input-otp-slot]:rounded-md *:data-[slot=input-otp-slot]:border">
<InputOTPSlot index={0} />
<InputOTPSlot index={1} />
<InputOTPSlot index={2} />
<InputOTPSlot index={3} />
</InputOTPGroup>
</InputOTP>
</div>
)
}

View File

@@ -0,0 +1,27 @@
import { Checkbox } from "@/registry/new-york-v4/ui/checkbox"
import { Input } from "@/registry/new-york-v4/ui/input"
import { Label } from "@/registry/new-york-v4/ui/label"
import { Textarea } from "@/registry/new-york-v4/ui/textarea"
export function LabelDemo() {
return (
<div className="grid w-full max-w-sm gap-6">
<div className="flex items-center gap-3">
<Checkbox id="label-demo-terms" />
<Label htmlFor="label-demo-terms">Accept terms and conditions</Label>
</div>
<div className="grid gap-3">
<Label htmlFor="label-demo-username">Username</Label>
<Input id="label-demo-username" placeholder="Username" />
</div>
<div className="group grid gap-3" data-disabled={true}>
<Label htmlFor="label-demo-disabled">Disabled</Label>
<Input id="label-demo-disabled" placeholder="Disabled" disabled />
</div>
<div className="grid gap-3">
<Label htmlFor="label-demo-message">Message</Label>
<Textarea id="label-demo-message" placeholder="Message" />
</div>
</div>
)
}

View File

@@ -0,0 +1,130 @@
import { HelpCircleIcon, SettingsIcon, Trash2Icon } from "lucide-react"
import {
Menubar,
MenubarCheckboxItem,
MenubarContent,
MenubarGroup,
MenubarItem,
MenubarMenu,
MenubarRadioGroup,
MenubarRadioItem,
MenubarSeparator,
MenubarShortcut,
MenubarSub,
MenubarSubContent,
MenubarSubTrigger,
MenubarTrigger,
} from "@/registry/new-york-v4/ui/menubar"
export function MenubarDemo() {
return (
<Menubar>
<MenubarMenu>
<MenubarTrigger>File</MenubarTrigger>
<MenubarContent>
<MenubarItem>
New Tab <MenubarShortcut>T</MenubarShortcut>
</MenubarItem>
<MenubarItem>
New Window <MenubarShortcut>N</MenubarShortcut>
</MenubarItem>
<MenubarItem disabled>New Incognito Window</MenubarItem>
<MenubarSeparator />
<MenubarSub>
<MenubarSubTrigger>Share</MenubarSubTrigger>
<MenubarSubContent>
<MenubarItem>Email link</MenubarItem>
<MenubarItem>Messages</MenubarItem>
<MenubarItem>Notes</MenubarItem>
</MenubarSubContent>
</MenubarSub>
<MenubarSeparator />
<MenubarItem>
Print... <MenubarShortcut>P</MenubarShortcut>
</MenubarItem>
</MenubarContent>
</MenubarMenu>
<MenubarMenu>
<MenubarTrigger>Edit</MenubarTrigger>
<MenubarContent>
<MenubarItem>
Undo <MenubarShortcut>Z</MenubarShortcut>
</MenubarItem>
<MenubarItem>
Redo <MenubarShortcut>Z</MenubarShortcut>
</MenubarItem>
<MenubarSeparator />
<MenubarSub>
<MenubarSubTrigger>Find</MenubarSubTrigger>
<MenubarSubContent>
<MenubarItem>Search the web</MenubarItem>
<MenubarSeparator />
<MenubarItem>Find...</MenubarItem>
<MenubarItem>Find Next</MenubarItem>
<MenubarItem>Find Previous</MenubarItem>
</MenubarSubContent>
</MenubarSub>
<MenubarSeparator />
<MenubarItem>Cut</MenubarItem>
<MenubarItem>Copy</MenubarItem>
<MenubarItem>Paste</MenubarItem>
</MenubarContent>
</MenubarMenu>
<MenubarMenu>
<MenubarTrigger>View</MenubarTrigger>
<MenubarContent>
<MenubarCheckboxItem>Always Show Bookmarks Bar</MenubarCheckboxItem>
<MenubarCheckboxItem checked>
Always Show Full URLs
</MenubarCheckboxItem>
<MenubarSeparator />
<MenubarItem inset>
Reload <MenubarShortcut>R</MenubarShortcut>
</MenubarItem>
<MenubarItem disabled inset>
Force Reload <MenubarShortcut>R</MenubarShortcut>
</MenubarItem>
<MenubarSeparator />
<MenubarItem inset>Toggle Fullscreen</MenubarItem>
<MenubarSeparator />
<MenubarItem inset>Hide Sidebar</MenubarItem>
</MenubarContent>
</MenubarMenu>
<MenubarMenu>
<MenubarTrigger>Profiles</MenubarTrigger>
<MenubarContent>
<MenubarRadioGroup value="benoit">
<MenubarRadioItem value="andy">Andy</MenubarRadioItem>
<MenubarRadioItem value="benoit">Benoit</MenubarRadioItem>
<MenubarRadioItem value="Luis">Luis</MenubarRadioItem>
</MenubarRadioGroup>
<MenubarSeparator />
<MenubarItem inset>Edit...</MenubarItem>
<MenubarSeparator />
<MenubarItem inset>Add Profile...</MenubarItem>
</MenubarContent>
</MenubarMenu>
<MenubarMenu>
<MenubarTrigger>More</MenubarTrigger>
<MenubarContent>
<MenubarGroup>
<MenubarItem>
<SettingsIcon />
Settings
</MenubarItem>
<MenubarItem>
<HelpCircleIcon />
Help
</MenubarItem>
<MenubarSeparator />
<MenubarItem variant="destructive">
<Trash2Icon />
Delete
</MenubarItem>
</MenubarGroup>
</MenubarContent>
</MenubarMenu>
</Menubar>
)
}

View File

@@ -0,0 +1,34 @@
"use client"
import * as React from "react"
import { MoonIcon, SunIcon } from "lucide-react"
import { useTheme } from "next-themes"
import { META_THEME_COLORS, useMetaColor } from "@/hooks/use-meta-color"
import { Button } from "@/registry/new-york-v4/ui/button"
export function ModeSwitcher() {
const { setTheme, resolvedTheme } = useTheme()
const { setMetaColor } = useMetaColor()
const toggleTheme = React.useCallback(() => {
setTheme(resolvedTheme === "dark" ? "light" : "dark")
setMetaColor(
resolvedTheme === "dark"
? META_THEME_COLORS.light
: META_THEME_COLORS.dark
)
}, [resolvedTheme, setTheme, setMetaColor])
return (
<Button
variant="ghost"
className="group/toggle h-8 w-8 px-0"
onClick={toggleTheme}
>
<SunIcon className="hidden [html.dark_&]:block" />
<MoonIcon className="hidden [html.light_&]:block" />
<span className="sr-only">Toggle theme</span>
</Button>
)
}

View File

@@ -0,0 +1,27 @@
"use client"
import * as React from "react"
import { MoonIcon, SunIcon } from "lucide-react"
import { useTheme } from "next-themes"
import { Button } from "@/registry/new-york-v4/ui/button"
export function ModeToggle() {
const { setTheme, resolvedTheme } = useTheme()
const toggleTheme = React.useCallback(() => {
setTheme(resolvedTheme === "dark" ? "light" : "dark")
}, [resolvedTheme, setTheme])
return (
<Button
variant="ghost"
className="group/toggle h-8 w-8 px-0"
onClick={toggleTheme}
>
<SunIcon className="hidden [html.dark_&]:block" />
<MoonIcon className="hidden [html.light_&]:block" />
<span className="sr-only">Toggle theme</span>
</Button>
)
}

View File

@@ -0,0 +1,32 @@
"use client"
import Link from "next/link"
import { usePathname } from "next/navigation"
import {
NavigationMenu,
NavigationMenuItem,
NavigationMenuLink,
NavigationMenuList,
} from "@/registry/new-york-v4/ui/navigation-menu"
export function NavHeader() {
const pathname = usePathname()
return (
<NavigationMenu>
<NavigationMenuList className="gap-2 *:data-[slot=navigation-menu-item]:h-7 **:data-[slot=navigation-menu-link]:py-1 **:data-[slot=navigation-menu-link]:font-medium">
<NavigationMenuItem>
<NavigationMenuLink asChild data-active={pathname === "/"}>
<Link href="/">Home</Link>
</NavigationMenuLink>
</NavigationMenuItem>
<NavigationMenuItem>
<NavigationMenuLink asChild data-active={pathname === "/charts"}>
<Link href="/charts">Charts</Link>
</NavigationMenuLink>
</NavigationMenuItem>
</NavigationMenuList>
</NavigationMenu>
)
}

View File

@@ -0,0 +1,114 @@
"use client"
import {
BadgeCheck,
Bell,
ChevronsUpDown,
CreditCard,
LogOut,
Sparkles,
} from "lucide-react"
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/registry/new-york-v4/ui/avatar"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/registry/new-york-v4/ui/dropdown-menu"
import {
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
useSidebar,
} from "@/registry/new-york-v4/ui/sidebar"
export function NavUser({
user,
}: {
user: {
name: string
email: string
avatar: string
}
}) {
const { isMobile } = useSidebar()
return (
<SidebarMenu>
<SidebarMenuItem>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<SidebarMenuButton
size="lg"
className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
>
<Avatar className="h-8 w-8 rounded-lg">
<AvatarImage src={user.avatar} alt={user.name} />
<AvatarFallback className="rounded-lg">CN</AvatarFallback>
</Avatar>
<div className="grid flex-1 text-left text-sm leading-tight">
<span className="truncate font-semibold">{user.name}</span>
<span className="truncate text-xs">{user.email}</span>
</div>
<ChevronsUpDown className="ml-auto size-4" />
</SidebarMenuButton>
</DropdownMenuTrigger>
<DropdownMenuContent
className="w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg"
side={isMobile ? "bottom" : "right"}
align="end"
sideOffset={4}
>
<DropdownMenuLabel className="p-0 font-normal">
<div className="flex items-center gap-2 px-1 py-1.5 text-left text-sm">
<Avatar className="h-8 w-8 rounded-lg">
<AvatarImage src={user.avatar} alt={user.name} />
<AvatarFallback className="rounded-lg">CN</AvatarFallback>
</Avatar>
<div className="grid flex-1 text-left text-sm leading-tight">
<span className="truncate font-semibold">{user.name}</span>
<span className="truncate text-xs">{user.email}</span>
</div>
</div>
</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem>
<Sparkles />
Upgrade to Pro
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem>
<BadgeCheck />
Account
</DropdownMenuItem>
<DropdownMenuItem>
<CreditCard />
Billing
</DropdownMenuItem>
<DropdownMenuItem>
<Bell />
Notifications
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuItem>
<LogOut />
Log out
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</SidebarMenuItem>
</SidebarMenu>
)
}

View File

@@ -0,0 +1,201 @@
"use client"
import * as React from "react"
import Link from "next/link"
import {
NavigationMenu,
NavigationMenuContent,
NavigationMenuItem,
NavigationMenuLink,
NavigationMenuList,
NavigationMenuTrigger,
navigationMenuTriggerStyle,
} from "@/registry/new-york-v4/ui/navigation-menu"
const components: { title: string; href: string; description: string }[] = [
{
title: "Alert Dialog",
href: "/docs/primitives/alert-dialog",
description:
"A modal dialog that interrupts the user with important content and expects a response.",
},
{
title: "Hover Card",
href: "/docs/primitives/hover-card",
description:
"For sighted users to preview content available behind a link.",
},
{
title: "Progress",
href: "/docs/primitives/progress",
description:
"Displays an indicator showing the completion progress of a task, typically displayed as a progress bar.",
},
{
title: "Scroll-area",
href: "/docs/primitives/scroll-area",
description: "Visually or semantically separates content.",
},
{
title: "Tabs",
href: "/docs/primitives/tabs",
description:
"A set of layered sections of content—known as tab panels—that are displayed one at a time.",
},
{
title: "Tooltip",
href: "/docs/primitives/tooltip",
description:
"A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.",
},
]
export function NavigationMenuDemo() {
return (
<div className="hidden w-full flex-col items-center justify-center gap-6 md:flex">
<NavigationMenu>
<NavigationMenuList>
<NavigationMenuItem>
<NavigationMenuTrigger>Getting started</NavigationMenuTrigger>
<NavigationMenuContent>
<ul className="grid gap-2 md:w-[400px] lg:w-[500px] lg:grid-cols-[.75fr_1fr]">
<li className="row-span-3">
<NavigationMenuLink asChild>
<a
className="from-muted/50 to-muted flex h-full w-full flex-col justify-end rounded-md bg-linear-to-b p-6 no-underline outline-hidden select-none focus:shadow-md"
href="/"
>
<div className="mt-4 mb-2 text-lg font-medium">
shadcn/ui
</div>
<p className="text-muted-foreground text-sm leading-tight">
Beautifully designed components built with Tailwind CSS.
</p>
</a>
</NavigationMenuLink>
</li>
<ListItem href="/docs" title="Introduction">
Re-usable components built using Radix UI and Tailwind CSS.
</ListItem>
<ListItem href="/docs/installation" title="Installation">
How to install dependencies and structure your app.
</ListItem>
<ListItem href="/docs/primitives/typography" title="Typography">
Styles for headings, paragraphs, lists...etc
</ListItem>
</ul>
</NavigationMenuContent>
</NavigationMenuItem>
<NavigationMenuItem>
<NavigationMenuTrigger>Components</NavigationMenuTrigger>
<NavigationMenuContent>
<ul className="grid w-[400px] gap-2 md:w-[500px] md:grid-cols-2 lg:w-[600px]">
{components.map((component) => (
<ListItem
key={component.title}
title={component.title}
href={component.href}
>
{component.description}
</ListItem>
))}
</ul>
</NavigationMenuContent>
</NavigationMenuItem>
<NavigationMenuItem>
<NavigationMenuLink
asChild
className={navigationMenuTriggerStyle()}
>
<Link href="/docs">Documentation</Link>
</NavigationMenuLink>
</NavigationMenuItem>
</NavigationMenuList>
</NavigationMenu>
<NavigationMenu viewport={false}>
<NavigationMenuList>
<NavigationMenuItem>
<NavigationMenuLink
asChild
className={navigationMenuTriggerStyle()}
>
<Link href="/docs">Documentation</Link>
</NavigationMenuLink>
</NavigationMenuItem>
<NavigationMenuItem>
<NavigationMenuTrigger>List</NavigationMenuTrigger>
<NavigationMenuContent>
<ul className="grid w-[300px] gap-4">
<li>
<NavigationMenuLink asChild>
<Link href="#">
<div className="font-medium">Components</div>
<div className="text-muted-foreground">
Browse all components in the library.
</div>
</Link>
</NavigationMenuLink>
<NavigationMenuLink asChild>
<Link href="#">
<div className="font-medium">Documentation</div>
<div className="text-muted-foreground">
Learn how to use the library.
</div>
</Link>
</NavigationMenuLink>
<NavigationMenuLink asChild>
<Link href="#">
<div className="font-medium">Blog</div>
<div className="text-muted-foreground">
Read our latest blog posts.
</div>
</Link>
</NavigationMenuLink>
</li>
</ul>
</NavigationMenuContent>
</NavigationMenuItem>
<NavigationMenuItem>
<NavigationMenuTrigger>Simple List</NavigationMenuTrigger>
<NavigationMenuContent>
<ul className="grid w-[200px] gap-4">
<li>
<NavigationMenuLink asChild>
<Link href="#">Components</Link>
</NavigationMenuLink>
<NavigationMenuLink asChild>
<Link href="#">Documentation</Link>
</NavigationMenuLink>
<NavigationMenuLink asChild>
<Link href="#">Blocks</Link>
</NavigationMenuLink>
</li>
</ul>
</NavigationMenuContent>
</NavigationMenuItem>
</NavigationMenuList>
</NavigationMenu>
</div>
)
}
function ListItem({
title,
children,
href,
...props
}: React.ComponentPropsWithoutRef<"li"> & { href: string }) {
return (
<li {...props}>
<NavigationMenuLink asChild>
<Link href={href}>
<div className="text-sm leading-none font-medium">{title}</div>
<p className="text-muted-foreground line-clamp-2 text-sm leading-snug">
{children}
</p>
</Link>
</NavigationMenuLink>
</li>
)
}

View File

@@ -0,0 +1,40 @@
import {
Pagination,
PaginationContent,
PaginationEllipsis,
PaginationItem,
PaginationLink,
PaginationNext,
PaginationPrevious,
} from "@/registry/new-york-v4/ui/pagination"
export function PaginationDemo() {
return (
<div className="flex flex-col gap-6">
<Pagination>
<PaginationContent>
<PaginationItem>
<PaginationPrevious href="#" />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#">1</PaginationLink>
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" isActive>
2
</PaginationLink>
</PaginationItem>
<PaginationItem>
<PaginationLink href="#">3</PaginationLink>
</PaginationItem>
<PaginationItem>
<PaginationEllipsis />
</PaginationItem>
<PaginationItem>
<PaginationNext href="#" />
</PaginationItem>
</PaginationContent>
</Pagination>
</div>
)
}

View File

@@ -0,0 +1,62 @@
import { Button } from "@/registry/new-york-v4/ui/button"
import { Input } from "@/registry/new-york-v4/ui/input"
import { Label } from "@/registry/new-york-v4/ui/label"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/registry/new-york-v4/ui/popover"
export function PopoverDemo() {
return (
<Popover>
<PopoverTrigger asChild>
<Button variant="outline">Open popover</Button>
</PopoverTrigger>
<PopoverContent className="w-80" align="start">
<div className="grid gap-4">
<div className="grid gap-1.5">
<h4 className="leading-none font-medium">Dimensions</h4>
<p className="text-muted-foreground text-sm">
Set the dimensions for the layer.
</p>
</div>
<div className="grid gap-2">
<div className="grid grid-cols-3 items-center gap-4">
<Label htmlFor="width">Width</Label>
<Input
id="width"
defaultValue="100%"
className="col-span-2 h-8"
/>
</div>
<div className="grid grid-cols-3 items-center gap-4">
<Label htmlFor="maxWidth">Max. width</Label>
<Input
id="maxWidth"
defaultValue="300px"
className="col-span-2 h-8"
/>
</div>
<div className="grid grid-cols-3 items-center gap-4">
<Label htmlFor="height">Height</Label>
<Input
id="height"
defaultValue="25px"
className="col-span-2 h-8"
/>
</div>
<div className="grid grid-cols-3 items-center gap-4">
<Label htmlFor="maxHeight">Max. height</Label>
<Input
id="maxHeight"
defaultValue="none"
className="col-span-2 h-8"
/>
</div>
</div>
</div>
</PopoverContent>
</Popover>
)
}

View File

@@ -0,0 +1,16 @@
"use client"
import * as React from "react"
import { Progress } from "@/registry/new-york-v4/ui/progress"
export function ProgressDemo() {
const [progress, setProgress] = React.useState(13)
React.useEffect(() => {
const timer = setTimeout(() => setProgress(66), 500)
return () => clearTimeout(timer)
}, [])
return <Progress value={progress} className="w-[60%]" />
}

View File

@@ -0,0 +1,62 @@
import { Label } from "@/registry/new-york-v4/ui/label"
import {
RadioGroup,
RadioGroupItem,
} from "@/registry/new-york-v4/ui/radio-group"
const plans = [
{
id: "starter",
name: "Starter Plan",
description:
"Perfect for small businesses getting started with our platform",
price: "$10",
},
{
id: "pro",
name: "Pro Plan",
description: "Advanced features for growing businesses with higher demands",
price: "$20",
},
] as const
export function RadioGroupDemo() {
return (
<div className="flex flex-col gap-6">
<RadioGroup defaultValue="comfortable">
<div className="flex items-center gap-3">
<RadioGroupItem value="default" id="r1" />
<Label htmlFor="r1">Default</Label>
</div>
<div className="flex items-center gap-3">
<RadioGroupItem value="comfortable" id="r2" />
<Label htmlFor="r2">Comfortable</Label>
</div>
<div className="flex items-center gap-3">
<RadioGroupItem value="compact" id="r3" />
<Label htmlFor="r3">Compact</Label>
</div>
</RadioGroup>
<RadioGroup defaultValue="starter" className="max-w-sm">
{plans.map((plan) => (
<Label
className="hover:bg-accent/50 flex items-start gap-3 rounded-lg border p-3 has-[[data-state=checked]]:border-green-600 has-[[data-state=checked]]:bg-green-50 dark:has-[[data-state=checked]]:border-green-900 dark:has-[[data-state=checked]]:bg-green-950"
key={plan.id}
>
<RadioGroupItem
value={plan.id}
id={plan.name}
className="shadow-none data-[state=checked]:border-green-600 data-[state=checked]:bg-green-600 *:data-[slot=radio-group-indicator]:[&>svg]:fill-white *:data-[slot=radio-group-indicator]:[&>svg]:stroke-white"
/>
<div className="grid gap-1.5 font-normal">
<div className="font-medium">{plan.name}</div>
<div className="text-muted-foreground leading-snug">
{plan.description}
</div>
</div>
</Label>
))}
</RadioGroup>
</div>
)
}

View File

@@ -0,0 +1,70 @@
import {
ResizableHandle,
ResizablePanel,
ResizablePanelGroup,
} from "@/registry/new-york-v4/ui/resizable"
export function ResizableDemo() {
return (
<div className="flex w-full flex-col gap-6">
<ResizablePanelGroup
direction="horizontal"
className="max-w-md rounded-lg border md:min-w-[450px]"
>
<ResizablePanel defaultSize={50}>
<div className="flex h-[200px] items-center justify-center p-6">
<span className="font-semibold">One</span>
</div>
</ResizablePanel>
<ResizableHandle />
<ResizablePanel defaultSize={50}>
<ResizablePanelGroup direction="vertical">
<ResizablePanel defaultSize={25}>
<div className="flex h-full items-center justify-center p-6">
<span className="font-semibold">Two</span>
</div>
</ResizablePanel>
<ResizableHandle />
<ResizablePanel defaultSize={75}>
<div className="flex h-full items-center justify-center p-6">
<span className="font-semibold">Three</span>
</div>
</ResizablePanel>
</ResizablePanelGroup>
</ResizablePanel>
</ResizablePanelGroup>
<ResizablePanelGroup
direction="horizontal"
className="min-h-[200px] max-w-md rounded-lg border md:min-w-[450px]"
>
<ResizablePanel defaultSize={25}>
<div className="flex h-full items-center justify-center p-6">
<span className="font-semibold">Sidebar</span>
</div>
</ResizablePanel>
<ResizableHandle withHandle />
<ResizablePanel defaultSize={75}>
<div className="flex h-full items-center justify-center p-6">
<span className="font-semibold">Content</span>
</div>
</ResizablePanel>
</ResizablePanelGroup>
<ResizablePanelGroup
direction="vertical"
className="min-h-[200px] max-w-md rounded-lg border md:min-w-[450px]"
>
<ResizablePanel defaultSize={25}>
<div className="flex h-full items-center justify-center p-6">
<span className="font-semibold">Header</span>
</div>
</ResizablePanel>
<ResizableHandle />
<ResizablePanel defaultSize={75}>
<div className="flex h-full items-center justify-center p-6">
<span className="font-semibold">Content</span>
</div>
</ResizablePanel>
</ResizablePanelGroup>
</div>
)
}

View File

@@ -0,0 +1,80 @@
import * as React from "react"
import Image from "next/image"
import { ScrollArea, ScrollBar } from "@/registry/new-york-v4/ui/scroll-area"
import { Separator } from "@/registry/new-york-v4/ui/separator"
export function ScrollAreaDemo() {
return (
<div className="flex flex-col gap-6">
<ScrollAreaVertical />
<ScrollAreaHorizontalDemo />
</div>
)
}
const tags = Array.from({ length: 50 }).map(
(_, i, a) => `v1.2.0-beta.${a.length - i}`
)
function ScrollAreaVertical() {
return (
<div className="flex flex-col gap-6">
<ScrollArea className="h-72 w-48 rounded-md border">
<div className="p-4">
<h4 className="mb-4 text-sm leading-none font-medium">Tags</h4>
{tags.map((tag) => (
<React.Fragment key={tag}>
<div className="text-sm">{tag}</div>
<Separator className="my-2" />
</React.Fragment>
))}
</div>
</ScrollArea>
</div>
)
}
export const works = [
{
artist: "Ornella Binni",
art: "https://images.unsplash.com/photo-1465869185982-5a1a7522cbcb?auto=format&fit=crop&w=300&q=80",
},
{
artist: "Tom Byrom",
art: "https://images.unsplash.com/photo-1548516173-3cabfa4607e9?auto=format&fit=crop&w=300&q=80",
},
{
artist: "Vladimir Malyav",
art: "https://images.unsplash.com/photo-1494337480532-3725c85fd2ab?auto=format&fit=crop&w=300&q=80",
},
] as const
function ScrollAreaHorizontalDemo() {
return (
<ScrollArea className="w-full max-w-96 rounded-md border">
<div className="flex gap-4 p-4">
{works.map((artwork) => (
<figure key={artwork.artist} className="shrink-0">
<div className="overflow-hidden rounded-md">
<Image
src={artwork.art}
alt={`Photo by ${artwork.artist}`}
className="aspect-[3/4] h-fit w-fit object-cover"
width={300}
height={400}
/>
</div>
<figcaption className="text-muted-foreground pt-2 text-xs">
Photo by{" "}
<span className="text-foreground font-semibold">
{artwork.artist}
</span>
</figcaption>
</figure>
))}
</div>
<ScrollBar orientation="horizontal" />
</ScrollArea>
)
}

View File

@@ -0,0 +1,93 @@
import * as React from "react"
import {
ChartBarIcon,
ChartLineIcon,
ChartPieIcon,
CircleDashed,
} from "lucide-react"
import {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectLabel,
SelectTrigger,
SelectValue,
} from "@/registry/new-york-v4/ui/select"
export function SelectDemo() {
return (
<div className="flex flex-col gap-4">
<Select>
<SelectTrigger className="w-[180px]">
<SelectValue placeholder="Select a fruit" />
</SelectTrigger>
<SelectContent>
<SelectGroup>
<SelectLabel>Fruits</SelectLabel>
<SelectItem value="apple">Apple</SelectItem>
<SelectItem value="banana">Banana</SelectItem>
<SelectItem value="blueberry">Blueberry</SelectItem>
<SelectItem value="grapes" disabled>
Grapes
</SelectItem>
<SelectItem value="pineapple">Pineapple</SelectItem>
</SelectGroup>
</SelectContent>
</Select>
<Select>
<SelectTrigger className="w-[180px]">
<SelectValue placeholder="Large List" />
</SelectTrigger>
<SelectContent>
{Array.from({ length: 100 }).map((_, i) => (
<SelectItem key={i} value={`item-${i}`}>
Item {i}
</SelectItem>
))}
</SelectContent>
</Select>
<Select disabled>
<SelectTrigger className="w-[180px]">
<SelectValue placeholder="Disabled" />
</SelectTrigger>
<SelectContent>
<SelectItem value="apple">Apple</SelectItem>
<SelectItem value="banana">Banana</SelectItem>
<SelectItem value="blueberry">Blueberry</SelectItem>
<SelectItem value="grapes" disabled>
Grapes
</SelectItem>
<SelectItem value="pineapple">Pineapple</SelectItem>
</SelectContent>
</Select>
<Select>
<SelectTrigger className="w-[180px]">
<SelectValue
placeholder={
<>
<CircleDashed className="text-muted-foreground" />
With Icon
</>
}
/>
</SelectTrigger>
<SelectContent>
<SelectItem value="line">
<ChartLineIcon />
Line
</SelectItem>
<SelectItem value="bar">
<ChartBarIcon />
Bar
</SelectItem>
<SelectItem value="pie">
<ChartPieIcon />
Pie
</SelectItem>
</SelectContent>
</Select>
</div>
)
}

View File

@@ -0,0 +1,22 @@
import { Separator } from "@/registry/new-york-v4/ui/separator"
export function SeparatorDemo() {
return (
<div>
<div className="flex flex-col gap-1">
<div className="text-sm leading-none font-medium">Tailwind CSS</div>
<div className="text-muted-foreground text-sm">
A utility-first CSS framework.
</div>
</div>
<Separator className="my-4" />
<div className="flex h-5 items-center gap-4 text-sm">
<div>Blog</div>
<Separator orientation="vertical" />
<div>Docs</div>
<Separator orientation="vertical" />
<div>Source</div>
</div>
</div>
)
}

View File

@@ -0,0 +1,95 @@
import { Button } from "@/registry/new-york-v4/ui/button"
import { Input } from "@/registry/new-york-v4/ui/input"
import { Label } from "@/registry/new-york-v4/ui/label"
import {
Sheet,
SheetClose,
SheetContent,
SheetDescription,
SheetFooter,
SheetHeader,
SheetTitle,
SheetTrigger,
} from "@/registry/new-york-v4/ui/sheet"
const SHEET_SIDES = ["top", "right", "bottom", "left"] as const
export function SheetDemo() {
return (
<div className="flex flex-col gap-6 md:flex-row">
<Sheet>
<SheetTrigger asChild>
<Button variant="outline">Open</Button>
</SheetTrigger>
<SheetContent>
<SheetHeader>
<SheetTitle>Edit profile</SheetTitle>
<SheetDescription>
Make changes to your profile here. Click save when you&apos;re
done.
</SheetDescription>
</SheetHeader>
<div className="grid flex-1 auto-rows-min gap-6 px-4">
<div className="grid gap-3">
<Label htmlFor="sheet-demo-name">Name</Label>
<Input id="sheet-demo-name" defaultValue="Pedro Duarte" />
</div>
<div className="grid gap-3">
<Label htmlFor="sheet-demo-username">Username</Label>
<Input id="sheet-demo-username" defaultValue="@peduarte" />
</div>
</div>
<SheetFooter>
<Button type="submit">Save changes</Button>
<SheetClose asChild>
<Button variant="outline">Close</Button>
</SheetClose>
</SheetFooter>
</SheetContent>
</Sheet>
<div className="flex gap-2">
{SHEET_SIDES.map((side) => (
<Sheet key={side}>
<SheetTrigger asChild>
<Button variant="outline" className="capitalize">
{side}
</Button>
</SheetTrigger>
<SheetContent side={side}>
<SheetHeader>
<SheetTitle>Edit profile</SheetTitle>
<SheetDescription>
Make changes to your profile here. Click save when you&apos;re
done.
</SheetDescription>
</SheetHeader>
<div className="overflow-y-auto px-4 text-sm">
<h4 className="mb-4 text-lg leading-none font-medium">
Lorem Ipsum
</h4>
{Array.from({ length: 10 }).map((_, index) => (
<p key={index} className="mb-4 leading-normal">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed
do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
</p>
))}
</div>
<SheetFooter>
<Button type="submit">Save changes</Button>
<SheetClose asChild>
<Button variant="outline">Cancel</Button>
</SheetClose>
</SheetFooter>
</SheetContent>
</Sheet>
))}
</div>
</div>
)
}

View File

@@ -0,0 +1,29 @@
import { Card, CardContent, CardHeader } from "@/registry/new-york-v4/ui/card"
import { Skeleton } from "@/registry/new-york-v4/ui/skeleton"
export function SkeletonDemo() {
return (
<div className="flex w-full max-w-3xl flex-col gap-6">
<div className="flex items-center gap-4">
<Skeleton className="size-10 shrink-0 rounded-full" />
<div className="grid gap-2">
<Skeleton className="h-4 w-[150px]" />
<Skeleton className="h-4 w-[100px]" />
</div>
</div>
<div className="flex w-full flex-col gap-4 md:flex-row">
{Array.from({ length: 3 }).map((_, index) => (
<Card key={index} className="w-full">
<CardHeader>
<Skeleton className="h-4 w-2/3" />
<Skeleton className="h-4 w-1/2" />
</CardHeader>
<CardContent>
<Skeleton className="aspect-square w-full" />
</CardContent>
</Card>
))}
</div>
</div>
)
}

View File

@@ -0,0 +1,44 @@
"use client"
import * as React from "react"
import { Label } from "@/registry/new-york-v4/ui/label"
import { Slider } from "@/registry/new-york-v4/ui/slider"
export function SliderDemo() {
return (
<div className="flex w-full max-w-sm flex-col flex-wrap gap-6 md:flex-row">
<Slider defaultValue={[50]} max={100} step={1} />
<Slider defaultValue={[25, 50]} max={100} step={1} />
<Slider defaultValue={[10, 20]} max={100} step={10} />
<div className="flex w-full items-center gap-6">
<Slider defaultValue={[50]} max={100} step={1} orientation="vertical" />
<Slider defaultValue={[25]} max={100} step={1} orientation="vertical" />
</div>
<SliderControlled />
</div>
)
}
function SliderControlled() {
const [value, setValue] = React.useState([0.3, 0.7])
return (
<div className="grid w-full gap-3">
<div className="flex items-center justify-between gap-2">
<Label htmlFor="slider-demo-temperature">Temperature</Label>
<span className="text-muted-foreground text-sm">
{value.join(", ")}
</span>
</div>
<Slider
id="slider-demo-temperature"
value={value}
onValueChange={setValue}
min={0}
max={1}
step={0.1}
/>
</div>
)
}

View File

@@ -0,0 +1,24 @@
"use client"
import { toast } from "sonner"
import { Button } from "@/registry/new-york-v4/ui/button"
export function SonnerDemo() {
return (
<Button
variant="outline"
onClick={() =>
toast("Event has been created", {
description: "Sunday, December 03, 2023 at 9:00 AM",
action: {
label: "Undo",
onClick: () => console.log("Undo"),
},
})
}
>
Show Toast
</Button>
)
}

View File

@@ -0,0 +1,34 @@
import { Label } from "@/registry/new-york-v4/ui/label"
import { Switch } from "@/registry/new-york-v4/ui/switch"
export function SwitchDemo() {
return (
<div className="flex flex-col gap-6">
<div className="flex items-center gap-2">
<Switch id="switch-demo-airplane-mode" />
<Label htmlFor="switch-demo-airplane-mode">Airplane Mode</Label>
</div>
<div className="flex items-center gap-2">
<Switch
id="switch-demo-bluetooth"
className="data-[state=checked]:bg-blue-500 dark:data-[state=checked]:bg-blue-600"
defaultChecked
/>
<Label htmlFor="switch-demo-bluetooth">Bluetooth</Label>
</div>
<Label className="flex items-center gap-6 rounded-lg border p-4 has-[[data-state=checked]]:border-blue-600">
<div className="flex flex-col gap-1">
<div className="font-medium">Share across devices</div>
<div className="text-muted-foreground text-sm font-normal">
Focus is shared across devices, and turns off when you leave the
app.
</div>
</div>
<Switch
id="switch-demo-focus-mode"
className="data-[state=checked]:bg-blue-500 dark:data-[state=checked]:bg-blue-600"
/>
</Label>
</div>
)
}

View File

@@ -0,0 +1,87 @@
import {
Table,
TableBody,
TableCaption,
TableCell,
TableFooter,
TableHead,
TableHeader,
TableRow,
} from "@/registry/new-york-v4/ui/table"
const invoices = [
{
invoice: "INV001",
paymentStatus: "Paid",
totalAmount: "$250.00",
paymentMethod: "Credit Card",
},
{
invoice: "INV002",
paymentStatus: "Pending",
totalAmount: "$150.00",
paymentMethod: "PayPal",
},
{
invoice: "INV003",
paymentStatus: "Unpaid",
totalAmount: "$350.00",
paymentMethod: "Bank Transfer",
},
{
invoice: "INV004",
paymentStatus: "Paid",
totalAmount: "$450.00",
paymentMethod: "Credit Card",
},
{
invoice: "INV005",
paymentStatus: "Paid",
totalAmount: "$550.00",
paymentMethod: "PayPal",
},
{
invoice: "INV006",
paymentStatus: "Pending",
totalAmount: "$200.00",
paymentMethod: "Bank Transfer",
},
{
invoice: "INV007",
paymentStatus: "Unpaid",
totalAmount: "$300.00",
paymentMethod: "Credit Card",
},
]
export function TableDemo() {
return (
<Table>
<TableCaption>A list of your recent invoices.</TableCaption>
<TableHeader>
<TableRow>
<TableHead className="w-[100px]">Invoice</TableHead>
<TableHead>Status</TableHead>
<TableHead>Method</TableHead>
<TableHead className="text-right">Amount</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{invoices.map((invoice) => (
<TableRow key={invoice.invoice}>
<TableCell className="font-medium">{invoice.invoice}</TableCell>
<TableCell>{invoice.paymentStatus}</TableCell>
<TableCell>{invoice.paymentMethod}</TableCell>
<TableCell className="text-right">{invoice.totalAmount}</TableCell>
</TableRow>
))}
</TableBody>
<TableFooter>
<TableRow>
<TableCell colSpan={3}>Total</TableCell>
<TableCell className="text-right">$2,500.00</TableCell>
</TableRow>
</TableFooter>
</Table>
)
}

View File

@@ -0,0 +1,106 @@
import { AppWindowIcon, CodeIcon } from "lucide-react"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/registry/new-york-v4/ui/card"
import { Input } from "@/registry/new-york-v4/ui/input"
import { Label } from "@/registry/new-york-v4/ui/label"
import {
Tabs,
TabsContent,
TabsList,
TabsTrigger,
} from "@/registry/new-york-v4/ui/tabs"
export function TabsDemo() {
return (
<div className="flex flex-col gap-6">
<Tabs defaultValue="account" className="max-w-[400px]">
<TabsList className="grid w-full grid-cols-2">
<TabsTrigger value="account">Account</TabsTrigger>
<TabsTrigger value="password">Password</TabsTrigger>
</TabsList>
<TabsContent value="account">
<Card>
<CardHeader>
<CardTitle>Account</CardTitle>
<CardDescription>
Make changes to your account here. Click save when you&apos;re
done.
</CardDescription>
</CardHeader>
<CardContent className="grid gap-6">
<div className="grid gap-3">
<Label htmlFor="tabs-demo-name">Name</Label>
<Input id="tabs-demo-name" defaultValue="Pedro Duarte" />
</div>
<div className="grid gap-3">
<Label htmlFor="tabs-demo-username">Username</Label>
<Input id="tabs-demo-username" defaultValue="@peduarte" />
</div>
</CardContent>
<CardFooter>
<Button>Save changes</Button>
</CardFooter>
</Card>
</TabsContent>
<TabsContent value="password">
<Card>
<CardHeader>
<CardTitle>Password</CardTitle>
<CardDescription>
Change your password here. After saving, you&apos;ll be logged
out.
</CardDescription>
</CardHeader>
<CardContent className="grid gap-6">
<div className="grid gap-3">
<Label htmlFor="tabs-demo-current">Current password</Label>
<Input id="tabs-demo-current" type="password" />
</div>
<div className="grid gap-3">
<Label htmlFor="tabs-demo-new">New password</Label>
<Input id="tabs-demo-new" type="password" />
</div>
</CardContent>
<CardFooter>
<Button>Save password</Button>
</CardFooter>
</Card>
</TabsContent>
</Tabs>
<Tabs defaultValue="home">
<TabsList>
<TabsTrigger value="home">Home</TabsTrigger>
<TabsTrigger value="settings">Settings</TabsTrigger>
</TabsList>
</Tabs>
<Tabs defaultValue="home">
<TabsList>
<TabsTrigger value="home">Home</TabsTrigger>
<TabsTrigger value="settings" disabled>
Disabled
</TabsTrigger>
</TabsList>
</Tabs>
<Tabs defaultValue="preview">
<TabsList>
<TabsTrigger value="preview">
<AppWindowIcon />
Preview
</TabsTrigger>
<TabsTrigger value="code">
<CodeIcon />
Code
</TabsTrigger>
</TabsList>
</Tabs>
</div>
)
}

Some files were not shown because too many files have changed in this diff Show More