Compare commits

...

217 Commits

Author SHA1 Message Date
Benjamin Canac
83c2b70d98 chore(release): v3.0.0-alpha.10 2024-12-09 11:11:40 +01:00
Benjamin Canac
3b9ca2263d fix(CommandPalette): keep ignoreFilter groups at their place (#2833) 2024-12-09 10:17:54 +01:00
renovate[bot]
6636543256 chore(deps): update all non-major dependencies (v3) (#2848)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-09 10:17:25 +01:00
Malik-Jouda
f98b91c22a fix(ColorPicker): handle RTL mode (#2858) 2024-12-09 10:17:05 +01:00
Benjamin Canac
857238ff14 chore(deps): update reka-ui 2024-12-08 11:02:40 +01:00
Christophe Carvalho Vilas-Boas
8b5d412fd7 feat(locale): add Portuguese language (#2855) 2024-12-07 01:09:00 +01:00
renovate[bot]
ed44d9d101 chore(deps): update devdependency @nuxt/test-utils to ^3.15.1 (v3) (#2839)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-07 01:08:21 +01:00
renovate[bot]
5a900e460b chore(deps): update tailwindcss to v4.0.0-beta.6 (v3) (#2853)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-07 00:55:35 +01:00
Christophe Carvalho Vilas-Boas
4b241ba3c3 fix(types): handle array of strings in AppConfig (#2854) 2024-12-07 00:55:11 +01:00
Benjamin Canac
80befc107c fix(defineShortcuts): return useEventListener to unregister the listener
Resolves #2031
2024-12-06 23:37:22 +01:00
Benjamin Canac
6c946dc0e7 docs(deps): update @nuxt/ui-pro 2024-12-06 17:39:13 +01:00
Benjamin Canac
2d81c02356 docs(Header): use Drawer as menu 2024-12-06 17:20:21 +01:00
Benjamin Canac
d3b3b9bef3 docs(installation): add app section 2024-12-06 17:20:21 +01:00
Benjamin Canac
b7ba2c7759 fix(Modal): prevent from going out of screen
Resolves #2711
2024-12-06 17:20:21 +01:00
Malik-Jouda
198d04de51 fix(Stepper): handle RTL mode (#2844) 2024-12-06 15:08:39 +01:00
renovate[bot]
16e0339e7a chore(deps): update all non-major dependencies (v3) (#2820)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-06 11:18:34 +01:00
Benjamin Canac
6f1f9f4d81 docs(app): update module & framework select 2024-12-05 23:36:02 +01:00
Benjamin Canac
46f4e5a24d docs(app): redirect when module changes
Resolves #2840
2024-12-05 23:26:44 +01:00
Benjamin Canac
b983ea2aec docs(app): hide github link on mobile 2024-12-05 19:13:26 +01:00
Benjamin Canac
bd4abfa880 docs(app): improve module select padding 2024-12-05 19:12:01 +01:00
Benjamin Canac
c1ff978370 fix(Tabs): truncate not working 2024-12-05 19:11:51 +01:00
Benjamin Canac
984bb0899c docs(app): use tabs to switch framework & module (#2837) 2024-12-05 19:01:40 +01:00
Benjamin Canac
a938d24f90 fix(Tabs): prevent hover on disabled 2024-12-05 18:15:03 +01:00
Benjamin Canac
0f8c398673 docs: handle @nuxt/ui-pro components display 2024-12-05 16:43:12 +01:00
Benjamin Canac
695224f91f chore(ContextMenu/DropdownMenu/NavigationMenu): consistent trailing slot 2024-12-05 16:29:28 +01:00
Benjamin Canac
4b653ef773 feat(NavigationMenu): handle item.trailingIcon display 2024-12-05 16:29:28 +01:00
Benjamin Canac
816bb69deb fix(Stepper): missing import 2024-12-05 15:22:25 +01:00
Benjamin Canac
5a7c3b13d3 docs(SupportedLanguages): improve emojis 2024-12-05 15:16:41 +01:00
Benjamin Canac
b741ef3313 feat(Avatar): add default slot for fallback 2024-12-05 15:16:28 +01:00
Benjamin Canac
bc80a0121f chore(ColorPicker): use reka-ui 2024-12-05 14:47:48 +01:00
Alex
e475b6438d feat(ColorPicker): implement component (#2670)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-12-05 14:11:43 +01:00
Benjamin Canac
3e283117d2 docs(app): missing target _blank on links 2024-12-05 12:21:50 +01:00
Romain Hamel
6484d010a1 feat(Stepper): new component (#2733)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-12-05 12:20:45 +01:00
renovate[bot]
d539109357 chore(deps): update tailwindcss to v4.0.0-beta.5 (v3) (#2791)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-04 21:32:35 +01:00
Benjamin Canac
01c3934403 docs: add @nuxt/ui-pro source (#2775) 2024-12-04 21:15:07 +01:00
Benjamin Canac
e79103131f chore(deps): dedupe 2024-12-04 14:46:24 +01:00
Benjamin Canac
37f05e2ba8 docs(deps): update @nuxt/ui-pro 2024-12-03 16:43:39 +01:00
Benjamin Canac
81ac076219 feat(module)!: migrate to reka-ui (#2448) 2024-12-03 16:11:32 +01:00
phbe
c440c91a29 fix(locale): improve German translation (#2826) 2024-12-03 16:06:18 +01:00
sam
b7ff7d8aa6 feat(locale): add Brazilian Portuguese language (#2825) 2024-12-03 13:53:25 +01:00
Jakub Jelínek
68a10f09d5 feat(locale): add Slovak language (#2821) 2024-12-02 17:38:11 +01:00
Christian López C
004a577467 feat(Table): handle meta.class on th and td (#2790)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-12-02 13:43:08 +01:00
renovate[bot]
f712135576 chore(deps): lock file maintenance (v3) (#2818)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-02 11:24:16 +01:00
Benjamin Canac
e2aaf5ba21 chore(renovate): ignore typescript 2024-12-02 11:05:26 +01:00
renovate[bot]
d65c7376d9 chore(deps): update all non-major dependencies (v3) (#2754)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-12-02 11:03:49 +01:00
Benjamin Canac
f04c2082ad docs(Header): move dropdown out of link 2024-11-30 11:48:13 +01:00
Benjamin Canac
bda6098db3 docs(app): improve navigation 2024-11-29 17:28:19 +01:00
Benjamin Canac
8344d852a5 docs(deps): update @nuxt/content & @nuxt/ui-pro 2024-11-29 17:28:10 +01:00
Benjamin Canac
6bd8a06871 docs(Header): replace badge by dropdown 2024-11-29 16:46:20 +01:00
Benjamin Canac
148b02464d fix(components): specify collisionPadding to all menus 2024-11-29 16:39:35 +01:00
Benjamin Canac
1240a3b604 docs(deps): update @nuxt/content 2024-11-29 16:15:49 +01:00
Benjamin Canac
e3b8d0e60e docs(deps): update @nuxt/content 2024-11-29 16:01:33 +01:00
Benjamin Canac
0d41210c91 docs: improve callout links 2024-11-29 12:41:31 +01:00
Guillaume Chau
bc2bcb30d9 fix(icons): make loading icon clockwise (#2797)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-28 15:18:14 +01:00
Aaron Dewes
ed2722257a fix(ContextMenu): remove close animation (#2798) 2024-11-28 14:56:18 +01:00
Romain Hamel
f06fbafc1e fix(devtools): error with renderer when colorMode is disabled (#2792) 2024-11-28 10:51:55 +01:00
Kotering
ecc4755a17 feat(locale): add Japanese language (#2794) 2024-11-28 10:25:37 +01:00
Benjamin Canac
9b58ce05f0 chore(icons): sort 2024-11-27 20:22:45 +01:00
Sébastien Chopin
a481410c5f docs(installation):add UI template instructions 2024-11-27 16:36:57 +01:00
Benjamin Canac
cd7ab3b2b9 docs(theme): fix framework-only usage 2024-11-27 15:55:30 +01:00
Benjamin Canac
9a17f90985 docs(app): hide links slot 2024-11-27 15:17:27 +01:00
Alex
3496b2d541 docs(content): consistent callouts links style (#2786) 2024-11-27 14:28:19 +01:00
Sandro Circi
a6c22052e1 fix(Link): partial query match for Vue (#2787) 2024-11-27 14:27:47 +01:00
Benjamin Canac
6eb0bbbe1b docs(app): update error 2024-11-27 12:39:51 +01:00
Benjamin Canac
a2512f680d feat(css): use color-scheme utilities on body 2024-11-27 12:37:29 +01:00
Benjamin Canac
4eb79021ed chore(renovate): update
Co-Authored-By: Sébastien Chopin <seb@nuxt.com>
2024-11-27 12:37:01 +01:00
renovate[bot]
8a45c25df3 chore(deps): update vueuse monorepo to v12 (v3) (major) (#2784)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-27 12:11:58 +01:00
Dafitra
004fa1ebcb refactor(App): remove default locale handling (#2760) 2024-11-27 10:35:12 +01:00
Malik-Jouda
0f648024e0 feat(Calendar): add icon props (#2778) 2024-11-26 18:31:25 +01:00
Benjamin Canac
e7995e7a0b docs(app): improve framework hydration (#2780)
Co-authored-by: Sébastien Chopin <seb@nuxt.com>
2024-11-26 18:23:26 +01:00
Alex
15ca2f5701 docs(ComponentCode): add cast prop (#2773) 2024-11-26 16:13:47 +01:00
Benjamin Canac
08b9e4bff0 chore(README): update 2024-11-26 15:18:21 +01:00
Benjamin Canac
f49b49fd2c docs(app): update header github link 2024-11-26 15:10:17 +01:00
Benjamin Canac
a74e8c4444 docs(robots): update 2024-11-26 15:10:08 +01:00
Benjamin Canac
781081132d chore(README): update github links 2024-11-26 15:10:00 +01:00
Malik-Jouda
b1550d58ad fix(Table): handle loading animation in RTL mode (#2771) 2024-11-26 14:45:03 +01:00
Malik-Jouda
e7b69b7d6f fix(Calendar): handle icons in RTL mode (#2770) 2024-11-26 13:17:06 +01:00
Benjamin Canac
9478fc0768 fix(Calendar): omit as / asChild props 2024-11-26 13:12:11 +01:00
Alex
2e9aeb5f05 feat(Calendar): implement component (#2618)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-26 12:24:20 +01:00
Benjamin Canac
86f2b4856c fix(NavigationMenu): wrong badge class
Resolves #2766
2024-11-26 12:23:01 +01:00
Benjamin Canac
ba874c9191 docs(app): framework select global (#2719)
Co-authored-by: harlan <harlan@harlanzw.com>
2024-11-25 15:47:52 +01:00
Benjamin Canac
ffc81cc950 chore(CommandPalette): pass active to children 2024-11-25 14:39:15 +01:00
Benjamin Canac
d783387ed3 test(CommandPalette): improve 2024-11-25 14:26:58 +01:00
Benjamin Canac
37655377e9 feat(CommandPalette): add active field on items for consistency 2024-11-25 14:22:39 +01:00
renovate[bot]
7ab88d30b2 chore(deps): lock file maintenance (v3) (#2752)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-25 12:48:44 +01:00
renovate[bot]
ccb79b7ee4 chore(deps): update all non-major dependencies (v3) (#2705)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-25 12:37:53 +01:00
kyyy
c9806da6d8 fix(Form)!: resolve async validation in yup & issue directly mutate state (#2702)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-23 19:30:20 +01:00
Dafitra
3bccb6782a fix(useLocale): update locale import to enable tree shaking (#2735) 2024-11-22 23:03:44 +01:00
renovate[bot]
5a01a81577 chore(deps): update tailwindcss to v4.0.0-beta.2 (v3) (#2736)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-22 23:03:00 +01:00
Arcitezz
3baddfd121 feat(i18n): add Dutch locale (#2728) 2024-11-22 12:44:27 +01:00
Benjamin Canac
a7a1227c93 fix(Breadcrumb): missing aria-hidden on presentation items
Resolves #2725
2024-11-22 09:53:26 +01:00
Benjamin Canac
b259ddf271 docs(app): update @source usage 2024-11-21 23:41:29 +01:00
Benjamin Canac
c47ffc1cd5 docs: update links to tailwind v4 beta docs 2024-11-21 23:23:45 +01:00
Malik-Jouda
0baa3a06d4 fix(Progress): handle horizontal animation in RTL mode (#2723) 2024-11-21 23:07:59 +01:00
renovate[bot]
b140dbfe63 chore(deps): update tailwindcss to v4.0.0-beta.1 (v3) (#2721)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-21 22:32:52 +01:00
Benjamin Canac
6d917baac0 chore(css): update reset styles
https://github.com/tailwindlabs/tailwindcss/pull/15064
2024-11-21 22:31:37 +01:00
renovate[bot]
c511c95537 chore(deps): update tailwindcss to v4.0.0-alpha.36 (v3) (#2718)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Sandro Circi <sandro.circi@digitoolmedia.com>
2024-11-21 22:18:50 +01:00
Hasan Mumin
de8228e504 feat(i18n): add Turkish locale (#2716) 2024-11-21 17:27:41 +01:00
Benjamin Canac
29d2acf564 docs(getting-started): update faq 2024-11-21 16:51:28 +01:00
Benjamin Canac
f5452ba0c5 docs(icon): add missing props 2024-11-21 15:54:36 +01:00
Alex
b6a841e975 docs(i18n): display supported languages in a cards (#2709) 2024-11-21 11:21:35 +01:00
renovate[bot]
7bf85e9a09 chore(deps): update tailwindcss to v4.0.0-alpha.35 (v3) (#2707)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-21 10:56:00 +01:00
Benjamin Canac
9e8d50b2b8 chore(deps): dedupe 2024-11-20 18:54:15 +01:00
Benjamin Canac
b13b9e3ec0 docs(deps): update @nuxt/content to 3.0.0-alpha.7 2024-11-20 18:53:53 +01:00
Benjamin Canac
126c893635 docs(deps): update @nuxt/ui-pro 2024-11-20 17:56:34 +01:00
Farnabaz
7d8b721bdd docs(deps): update @nuxt/content (#2706) 2024-11-20 13:44:37 +01:00
renovate[bot]
b120e8d998 chore(deps): update all non-major dependencies (v3) (#2694)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-20 10:21:21 +01:00
renovate[bot]
2c4634a58f chore(deps): update nuxt framework to ^3.14.1592 (v3) (#2700)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-20 10:20:55 +01:00
Dewdew
2cbf83eb84 feat(locale): translate Korean (#2703)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-20 09:58:52 +01:00
Benjamin Canac
da1b0bac04 docs(dropdown-menu/context-menu): move class to ui.content
After a6ecef0f fix
2024-11-20 09:51:19 +01:00
Benjamin Canac
7cc51d2efa test: update snapshots 2024-11-20 09:35:04 +01:00
Benjamin Canac
c163ed8187 docs: improve titles 2024-11-19 22:52:23 +01:00
Benjamin Canac
a6ecef0f0d fix(components): apply class on trigger instead of content when present
Resolves #2132
2024-11-19 22:10:27 +01:00
Benjamin Canac
faec8260a4 test(Popover/Tooltip): add class / ui props 2024-11-19 22:09:33 +01:00
Malik-Jouda
7a02bfeba6 playground: improve responsive (#2675) 2024-11-19 19:26:09 +01:00
Benjamin Canac
9dd525ca26 docs(deps): update @nuxt/content to alpha.6 (#2692) 2024-11-19 18:41:04 +01:00
Benjamin Canac
21d8c352a9 chore(release): v3.0.0-alpha.9 2024-11-19 16:03:52 +01:00
Benjamin Canac
5deadc7096 Revert "docs(ComponentCode/ComponentExample): use relative imports"
This reverts commit d75f47419d.
2024-11-19 15:54:51 +01:00
Benjamin Canac
fa9f0a7e2a chore(Toaster): use ToastPortal from radix-vue 2024-11-19 15:41:26 +01:00
Alex
143c015bbd docs(i18n): display supported languages in a table (#2684)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-19 15:33:01 +01:00
Benjamin Canac
d75f47419d docs(ComponentCode/ComponentExample): use relative imports 2024-11-19 15:18:06 +01:00
Alex
7b148daf1f cli: fix line break doc template (#2687) 2024-11-19 14:06:48 +01:00
Benjamin Canac
30e0c7fddd docs(deps): update @nuxt/ui-pro 2024-11-19 12:24:40 +01:00
Mohet
14fb21be00 feat(locale): add Persian language (#2682)
Co-authored-by: Ali Zemani <ali.ze@arianatech.ir>
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-19 12:10:09 +01:00
renovate[bot]
25091bad48 chore(deps): lock file maintenance (v3) (#2672)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-19 11:59:54 +01:00
renovate[bot]
b75ed29068 chore(deps): update all non-major dependencies (v3) (#2679)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-19 11:40:06 +01:00
Thomas
b2fa65734b fix(css): --font-family-sans renamed to --font-sans (#2680)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-19 10:07:01 +01:00
Dewdew
d3a079a644 fix(Textarea): autoresize does not work when initializing modelValue (#2681) 2024-11-19 10:02:19 +01:00
renovate[bot]
8c6a8c283f chore(deps): update all non-major dependencies (v3) (#2642)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-18 23:18:35 +01:00
kicaj
2fc36c878c feat(locale): add Polish language (#2678) 2024-11-18 22:49:05 +01:00
Aaron Dewes
992be91823 fix(locale): Improve German translation (#2676) 2024-11-18 21:59:27 +01:00
Alex
bd2f077fe8 feat(InputNumber): implement component (#2577)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-18 10:08:57 +01:00
Sandro Circi
7329900ae5 feat(Link): allow partial query match for its active state (#2664)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-17 12:16:19 +01:00
Benjamin Canac
8d85498ee1 fix(Button): improve neutral solid variant hover 2024-11-16 21:59:27 +01:00
Benjamin Canac
5c292cf620 chore(Alert/Toast): improve tsdoc 2024-11-16 14:27:16 +01:00
Benjamin Canac
c0837059a9 playground: add color mode button 2024-11-15 12:58:06 +01:00
Benjamin Canac
f5ea2411dc chore(package): add dev:vue script 2024-11-15 12:57:55 +01:00
Malik-Jouda
1fbbfe8df0 fix(Carousel): use dir from locale (#2647) 2024-11-15 12:00:51 +01:00
Sandro Circi
0daac5bafb fix(Toast): unreachable behind overlays (#2650)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-15 11:59:08 +01:00
Benjamin Canac
756f791a1a fix(Breadcrumb): render as nav
Resolves #2649
2024-11-15 09:52:44 +01:00
Eduard Aymerich
8ed434c105 feat(locale): translate Spanish (#2644) 2024-11-15 09:48:11 +01:00
renovate[bot]
190a2c9799 chore(deps): update tailwindcss to v4.0.0-alpha.34 (v3) (#2645)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-15 09:47:16 +01:00
Alex
e55c0e2594 feat(locale): typing dir (#2643) 2024-11-14 19:53:35 +01:00
Benjamin Canac
4312ca4702 docs(deps): update @nuxt/ui-pro 2024-11-14 18:26:50 +01:00
renovate[bot]
2289742656 chore(deps): update dependency @nuxt/icon to ^1.7.5 (v3) (#2639)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-14 16:45:20 +01:00
Benjamin Canac
601f4b2cd2 fix(PinInput): missing useFormField import 2024-11-14 15:57:21 +01:00
Benjamin Canac
cd080541a0 docs(deps): add @iconify-json/logos 2024-11-14 15:45:22 +01:00
Benjamin Canac
5722e0802d playground(deps): add @iconify-json/simple-icons 2024-11-14 15:44:35 +01:00
Benjamin Canac
8d0026558a fix(css): remove useless spacing override 2024-11-14 11:47:58 +01:00
Malik-Jouda
e5119a9ca4 fix(Breadcrumb/Carousel/Pagination): handle icons in RTL mode (#2633) 2024-11-14 10:17:55 +01:00
renovate[bot]
976dd2a386 chore(deps): update all non-major dependencies (v3) (#2629)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-14 10:16:27 +01:00
Benjamin Canac
1d95eb7246 docs(input): add more examples 2024-11-13 16:58:21 +01:00
Benjamin Canac
7cc26d098d fix(App): remove dir prop (#2630) 2024-11-13 16:23:08 +01:00
Guillaume Chau
9241ba1230 fix(FormField): missing conditions to apply container classes (#2631)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-13 15:57:35 +01:00
Daniel Roe
3396d5cebe ci: run vite build to test playground (#2624) 2024-11-13 12:22:46 +01:00
Alex
937585cb3f feat(locale): provide dir on defineLocale (#2620)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-13 12:19:21 +01:00
renovate[bot]
9c00f7c7b7 chore(deps): update all non-major dependencies (v3) (#2626)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-13 11:58:02 +01:00
Sandro Circi
73e25ed235 fix(locale): it translation (#2623) 2024-11-12 21:25:25 +01:00
kyyy
75c5e87724 feat(Form): apply transformations (#2550)
Co-authored-by: Romain Hamel <rom.hml@gmail.com>
2024-11-12 16:43:40 +01:00
max
95aa6f68b3 feat(PinInput): implement component (#2570)
Co-authored-by: Max Steinwand <msteinwand@kues.de>
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
Co-authored-by: Romain Hamel <rom.hml@gmail.com>
2024-11-12 16:11:06 +01:00
Inesh Bose
f516d7b36d feat(InputMenu/SelectMenu): add create-item prop (#2472)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-12 15:28:18 +01:00
renovate[bot]
300ccc4885 chore(deps): update all non-major dependencies (v3) (#2605)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-12 14:29:28 +01:00
Alex
e48b416e3b cli: add doc template (#2616)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-12 14:19:32 +01:00
Romain Hamel
17170bb998 playground(form): update examples (#2613) 2024-11-12 13:57:04 +01:00
renovate[bot]
fa5a3752c9 chore(deps): update tailwindcss to v4.0.0-alpha.33 (v3) (#2493)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-12 13:56:31 +01:00
Benjamin Canac
fc9711223b chore(github): update issue templates 2024-11-12 13:11:42 +01:00
Alex
8a8b1ee2e1 feat(locale): provide code (#2611) 2024-11-12 12:57:40 +01:00
Benjamin Canac
30218f1b5b feat(NavigationMenu): control items open & defaultOpen on vertical
Resolves #2608
2024-11-12 11:12:19 +01:00
Romain Hamel
3584a3328b fix(Form): match error-pattern on input validation (#2606) 2024-11-11 22:50:22 +01:00
renovate[bot]
6d3dbdbee5 chore(deps): update all non-major dependencies (v3) (#2598)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-11 21:07:54 +01:00
renovate[bot]
c614a0aafc chore(deps): lock file maintenance (v3) (#2596)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-11 19:26:57 +01:00
Sandro Circi
df7a61a97a fix(useLocale): missing import in various components (#2603) 2024-11-11 19:24:33 +01:00
Romain Hamel
143612ec73 feat(FormField): add error-pattern prop (#2601) 2024-11-11 18:35:27 +01:00
Benjamin Canac
18931acdb3 fix(InputMenu/SelectMenu): init filter with labelKey 2024-11-11 00:28:43 +01:00
Benjamin Canac
bbc6bf2455 docs(input-menu/select-menu): add countries picker examples 2024-11-11 00:08:16 +01:00
Benjamin Canac
ff1e0798d3 feat(SelectMenu): use UInput in search to handle props like icon
Resolves #2021
2024-11-10 23:22:44 +01:00
Benjamin Canac
b0be26d67f fix(Toaster): teleport to body
Resolves #2404
2024-11-10 19:21:50 +01:00
Benjamin Canac
36ea3e4045 chore(scripts): remove 2024-11-10 18:36:52 +01:00
Adam Kasper
4889d30b44 feat(locale): add support for Czech translation (#2593) 2024-11-10 18:17:32 +01:00
Benjamin Canac
944a7e0f07 Revert "fix(module): resolve #build/app.config import for vue and nuxt"
This reverts commit d6943e39c0.
2024-11-10 17:25:33 +01:00
Benjamin Canac
d6943e39c0 fix(module): resolve #build/app.config import for vue and nuxt
Resolves #2560
2024-11-10 16:45:46 +01:00
Benjamin Canac
ddb46905e7 fix(App): missing vue imports 2024-11-10 16:44:09 +01:00
renovate[bot]
0e74dbebce chore(deps): update all non-major dependencies (v3) (#2579)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-10 14:45:10 +01:00
Benjamin Canac
9e2cc5b125 fix(Modal/Slideover): prevent esc with prevent-close prop
Resolves #2501
2024-11-10 10:19:47 +01:00
Benjamin Canac
ea97759c2c feat(Popover): add prevent-close prop
Resolves #2245
2024-11-10 10:18:08 +01:00
Dewdew
95a0bbc581 fix(Link): missing relative import (#2588)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-10 10:05:17 +01:00
Benjamin Canac
ecd63ad8d6 test: update vue snapshots 2024-11-10 09:42:11 +01:00
Benjamin Canac
47f58f52ef fix(ContextMenu/DropdownMenu): relative imports with prefix 2024-11-10 09:39:37 +01:00
Benjamin Canac
446f9c1085 feat(Table): add caption prop 2024-11-09 23:55:26 +01:00
Benjamin Canac
7e8a1dd496 chore(readme): update 2024-11-09 22:06:55 +01:00
Benjamin Canac
89ee31b7ae chore(readme): update 2024-11-09 22:03:56 +01:00
Benjamin Canac
95be76940c docs(getting-started): use ::steps and mention css files 2024-11-09 22:03:49 +01:00
Benjamin Canac
761afaf40d docs(deps): update @nuxt/ui-pro 2024-11-09 21:50:20 +01:00
Sandro Circi
d167c9b807 fix(locale): Italian translation (#2584) 2024-11-09 16:15:43 +01:00
Alex
824ba56291 feat(cli): add locale command (#2586) 2024-11-09 16:14:29 +01:00
Sandro Circi
4fbbb25f68 feat(locale): add support for Italian (#2583) 2024-11-09 13:50:03 +01:00
Muhammad Mahmoud
602a667343 feat(locale): add support for Arabic (#2582) 2024-11-09 13:49:50 +01:00
BlackWhite
febda5c2b6 feat(locale): translate chinese (#2580) 2024-11-09 10:40:42 +01:00
Malik-Jouda
20379f51cc docs(nuxt.config): cannot use import.meta outside a module (#2578) 2024-11-09 10:06:56 +01:00
renovate[bot]
1ec56f3326 chore(deps): update all non-major dependencies (v3) (#2572)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-08 18:03:14 +01:00
Alex
1f44d58b64 docs(i18n): auto generated lang support (#2574)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-08 17:48:42 +01:00
Benjamin Canac
5392f988b8 docs(app): fetch files lazy on client 2024-11-08 17:35:42 +01:00
Alex
26362408b1 feat(module): support i18n in components (#2553)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-08 17:22:57 +01:00
renovate[bot]
1e7638bd03 chore(deps): update all non-major dependencies (v3) (#2563)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-11-08 16:55:39 +01:00
Romain Hamel
afe40033b0 fix(module): skip devtools renderer page injection if router integration is disabled (#2571) 2024-11-08 16:27:25 +01:00
Benjamin Canac
503f701c7e fix(InputMenu/SelectMenu): multiple not working with generic boolean casting
Resolves #2541
2024-11-08 10:59:13 +01:00
Benjamin Canac
d9822db6e8 chore(InputMenu/Select/SelectMenu): consistent types 2024-11-08 10:27:05 +01:00
Benjamin Canac
0ceafe1d54 fix(InputMenu/SelectMenu): look in items only with value-attribute
Resolves #2464
2024-11-08 10:26:44 +01:00
Benjamin Canac
f943f88fcc fix(InputMenu/SelectMenu): use isEqual from ohash 2024-11-08 10:19:02 +01:00
Benjamin Canac
e831813aa3 chore(git): ignore vue playground files 2024-11-07 22:35:50 +01:00
Benjamin Canac
37a359701f fix(module): remove fast-deep-equal in favor of custom isEqual 2024-11-07 21:56:56 +01:00
Benjamin Canac
557e0c92a4 docs(deps): revert @nuxt/content to 3.0.0-alpha.5 2024-11-07 21:54:42 +01:00
Benjamin Canac
7f6db45f1e feat(css): add --ui-bg-muted / --ui-border-muted variables
Those are used in Nuxt UI Pro
2024-11-07 21:43:49 +01:00
Benjamin Canac
a64a7104c5 docs(app): update links 2024-11-07 17:46:44 +01:00
Benjamin Canac
40fc8f3718 docs(app): remove icons from breadcrumb 2024-11-07 16:33:19 +01:00
Benjamin Canac
8059d540e3 docs(app): improve links 2024-11-07 16:25:01 +01:00
Benjamin Canac
42fce998e4 docs: remove markdown from descriptions 2024-11-07 15:21:38 +01:00
420 changed files with 35703 additions and 12641 deletions

View File

@@ -5,8 +5,8 @@ body:
- type: markdown
attributes:
value: |
> [!IMPORTANT]
> As Nuxt UI v3 is currently in alpha, we recommend thorough testing before using it in production environments. We're actively working on stabilization and welcome feedback from early adopters to improve the library.
> [!IMPORTANT]
> As Nuxt UI v3 is currently in alpha, we recommend thorough testing before using it in production environments. We're actively working on stabilization and welcome feedback from early adopters to improve the library.
- type: markdown
attributes:
value: |
@@ -29,11 +29,20 @@ body:
- Build Modules: `-`
validations:
required: true
- type: dropdown
id: package
attributes:
label: Is this bug related to Nuxt or Vue?
options:
- Nuxt
- Vue
validations:
required: true
- type: input
id: version
attributes:
label: Version
placeholder: v3.0.0-alpha.5
placeholder: v3.0.0-alpha.x
validations:
required: true
- type: textarea

View File

@@ -12,7 +12,7 @@ body:
label: For what version of Nuxt UI are you suggesting this?
options:
- v2.x
- v3-alpha
- v3.0.0-alpha.x
validations:
required: true
- type: textarea

View File

@@ -12,7 +12,7 @@ body:
label: For what version of Nuxt UI are you asking this question?
options:
- v2.x
- v3-alpha
- v3.0.0-alpha.x
validations:
required: true
- type: textarea

View File

@@ -61,5 +61,8 @@ jobs:
- name: Build
run: pnpm run build
- name: Build vue fixture
run: pnpm run test:vue:build
- name: Publish
run: pnpx pkg-pr-new publish --compact --no-template --pnpm

2
.gitignore vendored
View File

@@ -28,3 +28,5 @@ logs
playground-vue/auto-imports.d.ts
playground-vue/components.d.ts
playground-vue/tsconfig.app.tsbuildinfo
playground-vue/tsconfig.node.tsbuildinfo

View File

@@ -1,5 +1,121 @@
# Changelog
## [3.0.0-alpha.10](https://github.com/nuxt/ui/compare/v3.0.0-alpha.9...v3.0.0-alpha.10) (2024-12-09)
### ⚠ BREAKING CHANGES
* **module:** migrate to `reka-ui` (#2448)
* **Form:** resolve async validation in yup & issue directly mutate state (#2702)
### Features
* **Avatar:** add `default` slot for fallback ([b741ef3](https://github.com/nuxt/ui/commit/b741ef3313bb894beaed0eaa7323ee3d951bf935))
* **Calendar:** add `icon` props ([#2778](https://github.com/nuxt/ui/issues/2778)) ([0f64802](https://github.com/nuxt/ui/commit/0f648024e0468d34c1499bb5b5d2ed32e0e7de4f))
* **Calendar:** implement component ([#2618](https://github.com/nuxt/ui/issues/2618)) ([2e9aeb5](https://github.com/nuxt/ui/commit/2e9aeb5f05e94d63ea453c4f07a3e84ee2a02773))
* **ColorPicker:** implement component ([#2670](https://github.com/nuxt/ui/issues/2670)) ([e475b64](https://github.com/nuxt/ui/commit/e475b6438d405e4695ffb19155d456534d16b897))
* **CommandPalette:** add `active` field on items for consistency ([3765537](https://github.com/nuxt/ui/commit/37655377e9675982e2fce422bdd79ea651424548))
* **css:** use `color-scheme` utilities on body ([a2512f6](https://github.com/nuxt/ui/commit/a2512f680dc0df7add48bc17ef3be30d579be782))
* **i18n:** add Dutch locale ([#2728](https://github.com/nuxt/ui/issues/2728)) ([3baddfd](https://github.com/nuxt/ui/commit/3baddfd12186a68cc302f31cf0934cb9cf48060d))
* **i18n:** add Turkish locale ([#2716](https://github.com/nuxt/ui/issues/2716)) ([de8228e](https://github.com/nuxt/ui/commit/de8228e504affd1a57106101f5168a33702d4d53))
* **locale:** add Brazilian Portuguese language ([#2825](https://github.com/nuxt/ui/issues/2825)) ([b7ff7d8](https://github.com/nuxt/ui/commit/b7ff7d8aa63c41cf7afbecaa31824e098ea291af))
* **locale:** add Japanese language ([#2794](https://github.com/nuxt/ui/issues/2794)) ([ecc4755](https://github.com/nuxt/ui/commit/ecc4755a17874e59e06e70307a40dfd3fb3f20a0))
* **locale:** add Portuguese language ([#2855](https://github.com/nuxt/ui/issues/2855)) ([8b5d412](https://github.com/nuxt/ui/commit/8b5d412fd70b14a53cffa9129f5edd8a40e0f2e8))
* **locale:** add Slovak language ([#2821](https://github.com/nuxt/ui/issues/2821)) ([68a10f0](https://github.com/nuxt/ui/commit/68a10f09d5f164f2f5f07e65297e29fa2d939425))
* **locale:** translate Korean ([#2703](https://github.com/nuxt/ui/issues/2703)) ([2cbf83e](https://github.com/nuxt/ui/commit/2cbf83eb8484ad9abebd6ca01ad344918570af5b))
* **module:** migrate to `reka-ui` ([#2448](https://github.com/nuxt/ui/issues/2448)) ([81ac076](https://github.com/nuxt/ui/commit/81ac076219c3d7ef151f641414a0fbeca2da0bdd))
* **NavigationMenu:** handle `item.trailingIcon` display ([4b653ef](https://github.com/nuxt/ui/commit/4b653ef7735d9d2dfea65260433ade05eb3d3bd7))
* **Stepper:** new component ([#2733](https://github.com/nuxt/ui/issues/2733)) ([6484d01](https://github.com/nuxt/ui/commit/6484d010a1eee6f5d86968e4701b945953089b17))
* **Table:** handle `meta.class` on `th` and `td` ([#2790](https://github.com/nuxt/ui/issues/2790)) ([004a577](https://github.com/nuxt/ui/commit/004a5774678da24ccc267e96697c6088c51d5eea))
### Bug Fixes
* **Breadcrumb:** missing `aria-hidden` on presentation items ([a7a1227](https://github.com/nuxt/ui/commit/a7a1227c93110727e24f822fa50b547eb66bb16e)), closes [#2725](https://github.com/nuxt/ui/issues/2725)
* **Calendar:** handle icons in RTL mode ([#2770](https://github.com/nuxt/ui/issues/2770)) ([e7b69b7](https://github.com/nuxt/ui/commit/e7b69b7d6f0ebb3c578b9f58bcddf8ad36e6c6ce))
* **Calendar:** omit `as` / `asChild` props ([9478fc0](https://github.com/nuxt/ui/commit/9478fc076846d4a7fef13e63bdc274cd8d161063))
* **ColorPicker:** handle RTL mode ([#2858](https://github.com/nuxt/ui/issues/2858)) ([f98b91c](https://github.com/nuxt/ui/commit/f98b91c22ae21071a25f69cc8682eb6197a54c5a))
* **CommandPalette:** keep `ignoreFilter` groups at their place ([#2833](https://github.com/nuxt/ui/issues/2833)) ([3b9ca22](https://github.com/nuxt/ui/commit/3b9ca2263de1b936639b1b20ad0baf1cb059fda5))
* **components:** apply class on `trigger` instead of `content` when present ([a6ecef0](https://github.com/nuxt/ui/commit/a6ecef0f0d87a8dff4e4cb9ec507058ec94ed82b)), closes [#2132](https://github.com/nuxt/ui/issues/2132)
* **components:** specify collisionPadding to all menus ([148b024](https://github.com/nuxt/ui/commit/148b02464d47ada421313327585924b17f4e3f2d))
* **ContextMenu:** remove close animation ([#2798](https://github.com/nuxt/ui/issues/2798)) ([ed27222](https://github.com/nuxt/ui/commit/ed2722257a22c770eda811fbad58980bcef9dad5))
* **defineShortcuts:** return `useEventListener` to unregister the listener ([80befc1](https://github.com/nuxt/ui/commit/80befc107c6c6e7ab99dbe12376976babf315158)), closes [#2031](https://github.com/nuxt/ui/issues/2031)
* **devtools:** error with renderer when `colorMode` is disabled ([#2792](https://github.com/nuxt/ui/issues/2792)) ([f06fbaf](https://github.com/nuxt/ui/commit/f06fbafc1e709c7b4e54e2ba40d44c5770685a5d))
* **Form:** resolve async validation in yup & issue directly mutate state ([#2702](https://github.com/nuxt/ui/issues/2702)) ([c9806da](https://github.com/nuxt/ui/commit/c9806da6d850ea50ff8d2f11a1fbc5a43459b71f))
* **icons:** make `loading` icon clockwise ([#2797](https://github.com/nuxt/ui/issues/2797)) ([bc2bcb3](https://github.com/nuxt/ui/commit/bc2bcb30d97e2e873c4c7d535f82a4980cd35b02))
* **Link:** partial query match for Vue ([#2787](https://github.com/nuxt/ui/issues/2787)) ([a6c2205](https://github.com/nuxt/ui/commit/a6c22052e1c70e4ce6b2c7f783667a7f8c6cafa4))
* **locale:** improve German translation ([#2826](https://github.com/nuxt/ui/issues/2826)) ([c440c91](https://github.com/nuxt/ui/commit/c440c91a29fc1acd281a7f9d9b0cf74f5341553d))
* **Modal:** prevent from going out of screen ([b7ba2c7](https://github.com/nuxt/ui/commit/b7ba2c7759485ddb0a8bae589e4b6536ac9b1c96)), closes [#2711](https://github.com/nuxt/ui/issues/2711)
* **NavigationMenu:** wrong badge class ([86f2b48](https://github.com/nuxt/ui/commit/86f2b4856cc6beaf0440795500a5c74f9af04f36)), closes [#2766](https://github.com/nuxt/ui/issues/2766)
* **Progress:** handle `horizontal` animation in RTL mode ([#2723](https://github.com/nuxt/ui/issues/2723)) ([0baa3a0](https://github.com/nuxt/ui/commit/0baa3a06d449ab97093c451bd16215cf83c39447))
* **Stepper:** handle RTL mode ([#2844](https://github.com/nuxt/ui/issues/2844)) ([198d04d](https://github.com/nuxt/ui/commit/198d04de51d16ec7fcaa546370e4f67aa73bfee0))
* **Stepper:** missing import ([816bb69](https://github.com/nuxt/ui/commit/816bb69debdbf83f36c3ed3627985142e62b7dd1))
* **Table:** handle `loading` animation in RTL mode ([#2771](https://github.com/nuxt/ui/issues/2771)) ([b1550d5](https://github.com/nuxt/ui/commit/b1550d58adfeb09977619ad3ff7e776782a89603))
* **Tabs:** prevent hover on disabled ([a938d24](https://github.com/nuxt/ui/commit/a938d24f90431494c2da89411c301a228ab8d3f7))
* **Tabs:** truncate not working ([c1ff978](https://github.com/nuxt/ui/commit/c1ff978370fb343950837b380ccf02a33db53ccb))
* **types:** handle array of strings in AppConfig ([#2854](https://github.com/nuxt/ui/issues/2854)) ([4b241ba](https://github.com/nuxt/ui/commit/4b241ba3c32f4456252768b664488799a8278f0e))
* **useLocale:** update locale import to enable tree shaking ([#2735](https://github.com/nuxt/ui/issues/2735)) ([3bccb67](https://github.com/nuxt/ui/commit/3bccb6782a601e686df5d0ee405d738572f182e1))
## [3.0.0-alpha.9](https://github.com/nuxt/ui/compare/v3.0.0-alpha.8...v3.0.0-alpha.9) (2024-11-19)
### Features
* **cli:** add locale command ([#2586](https://github.com/nuxt/ui/issues/2586)) ([824ba56](https://github.com/nuxt/ui/commit/824ba5629183bc4cd59321213558770db211f6e5))
* **css:** add `--ui-bg-muted` / `--ui-border-muted` variables ([7f6db45](https://github.com/nuxt/ui/commit/7f6db45f1e15ef39cda9b732cb601c552f29570a))
* **Form:** apply transformations ([#2550](https://github.com/nuxt/ui/issues/2550)) ([75c5e87](https://github.com/nuxt/ui/commit/75c5e87724e7abdf0a6751d7a1dbbafb947f373f))
* **FormField:** add `error-pattern` prop ([#2601](https://github.com/nuxt/ui/issues/2601)) ([143612e](https://github.com/nuxt/ui/commit/143612ec737d1c7571398601c3222f2eed37996e))
* **InputMenu/SelectMenu:** add `create-item` prop ([#2472](https://github.com/nuxt/ui/issues/2472)) ([f516d7b](https://github.com/nuxt/ui/commit/f516d7b36da51565f4ab05a4c9cfe5e5b4015124))
* **InputNumber:** implement component ([#2577](https://github.com/nuxt/ui/issues/2577)) ([bd2f077](https://github.com/nuxt/ui/commit/bd2f077fe8e645d5fce8b1eb5a6eb1068b3e8f7c))
* **Link:** allow partial query match for its active state ([#2664](https://github.com/nuxt/ui/issues/2664)) ([7329900](https://github.com/nuxt/ui/commit/7329900ae549430b88567a09cbb585d3cf0a6d32))
* **locale:** add Persian language ([#2682](https://github.com/nuxt/ui/issues/2682)) ([14fb21b](https://github.com/nuxt/ui/commit/14fb21be0034ffc0ba5d213734c00f12e0d6bea8))
* **locale:** add Polish language ([#2678](https://github.com/nuxt/ui/issues/2678)) ([2fc36c8](https://github.com/nuxt/ui/commit/2fc36c878c67967ec91e4f6999575bad45521d44))
* **locale:** add support for Arabic ([#2582](https://github.com/nuxt/ui/issues/2582)) ([602a667](https://github.com/nuxt/ui/commit/602a667343be22b72383ab3cf42f36ec9e135082))
* **locale:** add support for Czech translation ([#2593](https://github.com/nuxt/ui/issues/2593)) ([4889d30](https://github.com/nuxt/ui/commit/4889d30b448296de42e146dc5771738837c31f8c))
* **locale:** add support for Italian ([#2583](https://github.com/nuxt/ui/issues/2583)) ([4fbbb25](https://github.com/nuxt/ui/commit/4fbbb25f68b0b5ee76e50f2da776a74d54acc041))
* **locale:** provide `code` ([#2611](https://github.com/nuxt/ui/issues/2611)) ([8a8b1ee](https://github.com/nuxt/ui/commit/8a8b1ee2e1628bc5439ef109d3c68b69bf631f81))
* **locale:** provide `dir` on `defineLocale` ([#2620](https://github.com/nuxt/ui/issues/2620)) ([937585c](https://github.com/nuxt/ui/commit/937585cb3f8bc902d60a4b5904711598204aee2d))
* **locale:** translate chinese ([#2580](https://github.com/nuxt/ui/issues/2580)) ([febda5c](https://github.com/nuxt/ui/commit/febda5c2b67374d1358a66694543b77037d239c6))
* **locale:** translate Spanish ([#2644](https://github.com/nuxt/ui/issues/2644)) ([8ed434c](https://github.com/nuxt/ui/commit/8ed434c105b75ae02aa7493a235cebb64d518d09))
* **locale:** typing `dir` ([#2643](https://github.com/nuxt/ui/issues/2643)) ([e55c0e2](https://github.com/nuxt/ui/commit/e55c0e25947e7bcef931b26dafaad120f488a627))
* **module:** support i18n in components ([#2553](https://github.com/nuxt/ui/issues/2553)) ([2636240](https://github.com/nuxt/ui/commit/26362408b161108487b889ff001bec9166059c79))
* **NavigationMenu:** control items `open` & `defaultOpen` on vertical ([30218f1](https://github.com/nuxt/ui/commit/30218f1b5b0a56207fd4db224ffa0401ac194a04)), closes [#2608](https://github.com/nuxt/ui/issues/2608)
* **PinInput:** implement component ([#2570](https://github.com/nuxt/ui/issues/2570)) ([95aa6f6](https://github.com/nuxt/ui/commit/95aa6f68b316d02c28d1124d9a826bca55cde81f))
* **Popover:** add `prevent-close` prop ([ea97759](https://github.com/nuxt/ui/commit/ea97759c2c219bdf5c48b652b47d293ddf513a00)), closes [#2245](https://github.com/nuxt/ui/issues/2245)
* **SelectMenu:** use `UInput` in search to handle props like icon ([ff1e079](https://github.com/nuxt/ui/commit/ff1e0798d384d40ad82a95fe5faa16acb080efe3)), closes [#2021](https://github.com/nuxt/ui/issues/2021)
* **Table:** add `caption` prop ([446f9c1](https://github.com/nuxt/ui/commit/446f9c1085e96187afdc5c1d7ce3450f8df1a2e1))
### Bug Fixes
* **App:** missing `vue` imports ([ddb4690](https://github.com/nuxt/ui/commit/ddb46905e7e3480ab578bcd8a478f25dff60081a))
* **App:** remove `dir` prop ([#2630](https://github.com/nuxt/ui/issues/2630)) ([7cc26d0](https://github.com/nuxt/ui/commit/7cc26d098dff70923bcd9d414d675018951b1967))
* **Breadcrumb/Carousel/Pagination:** handle icons in RTL mode ([#2633](https://github.com/nuxt/ui/issues/2633)) ([e5119a9](https://github.com/nuxt/ui/commit/e5119a9ca4e217ef769904323c16bd8c0cbc02d9))
* **Breadcrumb:** render as `nav` ([756f791](https://github.com/nuxt/ui/commit/756f791a1a8dd3a4a88c212b4e4f775584decb55)), closes [#2649](https://github.com/nuxt/ui/issues/2649)
* **Button:** improve neutral solid variant hover ([8d85498](https://github.com/nuxt/ui/commit/8d85498ee197ec0b26cdd7c4b08f84fec45ddd8f))
* **Carousel:** use `dir` from locale ([#2647](https://github.com/nuxt/ui/issues/2647)) ([1fbbfe8](https://github.com/nuxt/ui/commit/1fbbfe8df06b3b8b294615ac328d582c5230aa8b))
* **ContextMenu/DropdownMenu:** relative imports with prefix ([47f58f5](https://github.com/nuxt/ui/commit/47f58f52ef2d03176a184a3ca2154f5cea655edb))
* **css:** `--font-family-sans` renamed to `--font-sans` ([#2680](https://github.com/nuxt/ui/issues/2680)) ([b2fa657](https://github.com/nuxt/ui/commit/b2fa65734bb59186520c985f7c73fc34a0cb8b37))
* **css:** remove useless spacing override ([8d00265](https://github.com/nuxt/ui/commit/8d0026558a21efbbca08e9939844f7479a0d6cce))
* **FormField:** missing conditions to apply container classes ([#2631](https://github.com/nuxt/ui/issues/2631)) ([9241ba1](https://github.com/nuxt/ui/commit/9241ba1230b0fde41595634362d83c92c66b7699))
* **Form:** match `error-pattern` on input validation ([#2606](https://github.com/nuxt/ui/issues/2606)) ([3584a33](https://github.com/nuxt/ui/commit/3584a3328b8588f024557c9908242bc374853419))
* **InputMenu/SelectMenu:** init `filter` with `labelKey` ([18931ac](https://github.com/nuxt/ui/commit/18931acdb316bc72a3e5ed6d20985688ad5c8d99))
* **InputMenu/SelectMenu:** look in `items` only with `value-attribute` ([0ceafe1](https://github.com/nuxt/ui/commit/0ceafe1d54000f3eb49562b00c188d82fa23c4ee)), closes [#2464](https://github.com/nuxt/ui/issues/2464)
* **InputMenu/SelectMenu:** multiple not working with generic boolean casting ([503f701](https://github.com/nuxt/ui/commit/503f701c7ecdfe27e9057e5ddebfc7e03889d61b)), closes [#2541](https://github.com/nuxt/ui/issues/2541)
* **InputMenu/SelectMenu:** use `isEqual` from `ohash` ([f943f88](https://github.com/nuxt/ui/commit/f943f88fcc9f4678d8f7bd224799e289a0c57dd8))
* **Link:** missing relative import ([#2588](https://github.com/nuxt/ui/issues/2588)) ([95a0bbc](https://github.com/nuxt/ui/commit/95a0bbc581a40677f620eed3170f9a423976214b))
* **locale:** Improve German translation ([#2676](https://github.com/nuxt/ui/issues/2676)) ([992be91](https://github.com/nuxt/ui/commit/992be91823fe1877254ccd092c71c77dd3ff42f7))
* **locale:** it translation ([#2623](https://github.com/nuxt/ui/issues/2623)) ([73e25ed](https://github.com/nuxt/ui/commit/73e25ed23562f755ea4c66e6c5fb06dd18caac1e))
* **locale:** Italian translation ([#2584](https://github.com/nuxt/ui/issues/2584)) ([d167c9b](https://github.com/nuxt/ui/commit/d167c9b807a82fdf0fd280ce8417a66f86d7ed72))
* **Modal/Slideover:** prevent `esc` with `prevent-close` prop ([9e2cc5b](https://github.com/nuxt/ui/commit/9e2cc5b12567472044726924a3896b4b0e7993a1)), closes [#2501](https://github.com/nuxt/ui/issues/2501)
* **module:** remove `fast-deep-equal` in favor of custom `isEqual` ([37a3597](https://github.com/nuxt/ui/commit/37a359701f4b2ce4a9b0727b64c0e3eea6be00b4))
* **module:** skip devtools renderer page injection if router integration is disabled ([#2571](https://github.com/nuxt/ui/issues/2571)) ([afe4003](https://github.com/nuxt/ui/commit/afe40033b088d8aedb73fa8387a0284ef78444e4))
* **PinInput:** missing `useFormField` import ([601f4b2](https://github.com/nuxt/ui/commit/601f4b2cd2027817b935e02a0b4584dc3dce655f))
* **Textarea:** `autoresize` does not work when initializing `modelValue` ([#2681](https://github.com/nuxt/ui/issues/2681)) ([d3a079a](https://github.com/nuxt/ui/commit/d3a079a644db3dfe2f4e9567973550d74b3ba905))
* **Toaster:** teleport to `body` ([b0be26d](https://github.com/nuxt/ui/commit/b0be26d67feab467ac5862edd82e52df03a5091c)), closes [#2404](https://github.com/nuxt/ui/issues/2404)
* **Toast:** unreachable behind overlays ([#2650](https://github.com/nuxt/ui/issues/2650)) ([0daac5b](https://github.com/nuxt/ui/commit/0daac5bafb756c3a2dfaf2bf166c30c0eb476e08))
* **useLocale:** missing import in various components ([#2603](https://github.com/nuxt/ui/issues/2603)) ([df7a61a](https://github.com/nuxt/ui/commit/df7a61a97a14b3d7943baee6a74686134dfdb10b))
### Reverts
* Revert "docs(ComponentCode/ComponentExample): use relative imports" ([5deadc7](https://github.com/nuxt/ui/commit/5deadc709640bbfd3ec14c1c9363deb55e765d6a))
## [3.0.0-alpha.8](https://github.com/nuxt/ui/compare/v3.0.0-alpha.7...v3.0.0-alpha.8) (2024-11-07)
### ⚠ BREAKING CHANGES

View File

@@ -1,18 +1,23 @@
[![nuxt-ui.png](https://repository-images.githubusercontent.com/428329515/43fec891-9030-4601-8233-5d45ba5c6013)](https://ui.nuxt.com)
[![nuxt-ui.png](https://volta.s3.fr-par.scw.cloud/nuxt_ui_social_card_531d133fa2.png)](https://ui.nuxt.com)
# Nuxt UI v3
# Nuxt UI
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]
[![Nuxt][nuxt-src]][nuxt-href]
We're thrilled to introduce Nuxt UI v3, a significant upgrade to our UI library that delivers extensive improvements and robust new capabilities. This major update harnesses the combined strengths of [Radix Vue](https://www.radix-vue.com/), [Tailwind CSS v4](https://tailwindcss.com/blog/tailwindcss-v4-alpha), and [Tailwind Variants](https://www.tailwind-variants.org/) to offer developers an unparalleled set of tools for creating sophisticated, accessible, and highly performant user interfaces.
We're thrilled to introduce Nuxt UI v3, a significant upgrade to our UI library that delivers extensive improvements and robust new capabilities. This major update harnesses the combined strengths of [Reka UI](https://reka-ui.com/), [Tailwind CSS v4](https://tailwindcss.com/docs/v4-beta), and [Tailwind Variants](https://www.tailwind-variants.org/) to offer developers an unparalleled set of tools for creating sophisticated, accessible, and highly performant user interfaces.
> [!NOTE]
> You are on the `v3` development branch, check out the [dev branch](https://github.com/nuxt/ui) for Nuxt UI v2.
## Documentation
Visit https://ui3.nuxt.dev to explore the documentation.
## Installation
1. Install the Nuxt UI v3 alpha package:
```bash [pnpm]
pnpm add @nuxt/ui@next
```
@@ -29,10 +34,9 @@ npm install @nuxt/ui@next
bun add @nuxt/ui@next
```
> [!WARNING]
> Make sure you have `typescript` installed in your dev dependencies.
### Nuxt
2. Register the Nuxt UI module in your `nuxt.config.ts`:
1. Add the Nuxt UI module in your `nuxt.config.ts`:
```ts [nuxt.config.ts]
export default defineNuxtConfig({
@@ -40,18 +44,54 @@ export default defineNuxtConfig({
})
```
3. Import Tailwind CSS and Nuxt UI in your `app.vue` or [CSS](https://nuxt.com/docs/getting-started/styling#the-css-property):
2. Import Tailwind CSS and Nuxt UI in your CSS:
```vue [app.vue]
<style>
```css [assets/css/main.css]
@import "tailwindcss";
@import "@nuxt/ui";
</style>
```
## Documentation
Learn more in the [installation guide](https://ui3.nuxt.dev/getting-started/installation/nuxt).
Visit https://ui3.nuxt.dev to explore the documentation.
### Vue
1. Add the Nuxt UI Vite plugin in your `vite.config.ts`:
```ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'
export default defineConfig({
plugins: [
vue(),
ui()
]
})
```
2. Use the Nuxt UI Vue plugin in your `main.ts`:
```ts [main.ts]
import { createApp } from 'vue'
import ui from '@nuxt/ui/vue-plugin'
import App from './App.vue'
const app = createApp(App)
app.use(ui)
app.mount('#app')
```
3. Import Tailwind CSS and Nuxt UI in your CSS:
```css [assets/main.css]
@import "tailwindcss";
@import "@nuxt/ui";
```
Learn more in the [installation guide](https://ui3.nuxt.dev/getting-started/installation/vue).
## Credits
@@ -59,13 +99,13 @@ Visit https://ui3.nuxt.dev to explore the documentation.
- [nuxt/icon](https://github.com/nuxt/icon)
- [nuxt/fonts](https://github.com/nuxt/fonts)
- [nuxt-modules/color-mode](https://github.com/nuxt-modules/color-mode)
- [radix-vue/radix-vue](https://github.com/radix-vue/radix-vue)
- [unovue/reka-ui](https://github.com/unovue/reka-ui)
- [tailwindlabs/tailwindcss](https://github.com/tailwindlabs/tailwindcss)
- [vueuse/vueuse](https://github.com/vueuse/vueuse)
## License
Licensed under the [MIT license](https://github.com/nuxt/ui/blob/dev/LICENSE.md).
Licensed under the [MIT license](https://github.com/nuxt/ui/blob/v3/LICENSE.md).
<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/@nuxt/ui/next.svg?style=flat&colorA=18181B&colorB=28CF8D
@@ -75,7 +115,7 @@ Licensed under the [MIT license](https://github.com/nuxt/ui/blob/dev/LICENSE.md)
[npm-downloads-href]: https://npm.chart.dev/@nuxt/ui
[license-src]: https://img.shields.io/github/license/nuxt/ui.svg?style=flat&colorA=18181B&colorB=28CF8D
[license-href]: https://github.com/nuxt/ui/blob/main/LICENSE.md
[license-href]: https://github.com/nuxt/ui/blob/v3/LICENSE.md
[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
[nuxt-href]: https://nuxt.com

View File

@@ -3,13 +3,13 @@ import { resolve } from 'pathe'
import { defineCommand } from 'citty'
import { consola } from 'consola'
import { splitByCase, upperFirst, camelCase, kebabCase } from 'scule'
import { appendFile, sortFile } from '../utils.mjs'
import templates from '../templates.mjs'
import { appendFile, sortFile } from '../../utils.mjs'
import templates from '../../templates.mjs'
export default defineCommand({
meta: {
name: 'init',
description: 'Init a new component.'
name: 'component',
description: 'Make a new component.'
},
args: {
name: {

View File

@@ -0,0 +1,14 @@
import { defineCommand } from 'citty'
import component from './component.mjs'
import locale from './locale.mjs'
export default defineCommand({
meta: {
name: 'make',
description: 'Commands to create new Nuxt UI entities.'
},
subCommands: {
component,
locale
}
})

View File

@@ -0,0 +1,64 @@
import { existsSync, promises as fsp } from 'node:fs'
import { resolve } from 'pathe'
import { consola } from 'consola'
import { appendFile, sortFile, normalizeLocale } from '../../utils.mjs'
import { defineCommand } from 'citty'
export default defineCommand({
meta: {
name: 'locale',
description: 'Make a new locale.'
},
args: {
code: {
description: 'Locale code to create. For example: en.',
required: true
},
name: {
description: 'Locale name to create. For example: English.',
required: true
},
dir: {
description: 'Locale direction. For example: rtl.',
default: 'ltr'
}
},
async setup({ args }) {
const path = resolve('.')
const localePath = resolve(path, `src/runtime/locale`)
const originLocaleFilePath = resolve(localePath, 'en.ts')
const newLocaleFilePath = resolve(localePath, `${args.code}.ts`)
// Validate locale code
if (existsSync(newLocaleFilePath)) {
consola.error(`🚨 ${args.code} already exists!`)
process.exit(1)
}
if (!['ltr', 'rtl'].includes(args.dir)) {
consola.error(`🚨 Direction ${args.dir} not supported!`)
process.exit(1)
}
if (!args.code.match(/^[a-z]{2}(?:_[a-z]{2,4})?$/)) {
consola.error(`🚨 ${args.code} is not a valid locale code!\nExample: en or en_us`)
process.exit(1)
}
// Create new locale export
const localeExportFile = resolve(localePath, `index.ts`)
await appendFile(localeExportFile, `export { default as ${args.code} } from './${args.code}'`)
await sortFile(localeExportFile)
// Create new locale file
await fsp.copyFile(originLocaleFilePath, newLocaleFilePath)
const localeFile = await fsp.readFile(newLocaleFilePath, 'utf-8')
const rewrittenLocaleFile = localeFile
.replace(/name: '(.*)',/, `name: '${args.name}',`)
.replace(/code: '(.*)',/, `code: '${normalizeLocale(args.code)}',${(args.dir && args.dir !== 'ltr') ? `\n dir: '${args.dir}',` : ''}`)
await fsp.writeFile(newLocaleFilePath, rewrittenLocaleFile)
consola.success(`🪄 Generated ${newLocaleFilePath}`)
}
})

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env node
import { defineCommand, runMain } from 'citty'
import init from './commands/init.mjs'
import make from './commands/make/index.mjs'
const main = defineCommand({
meta: {
@@ -8,7 +8,7 @@ const main = defineCommand({
description: 'Nuxt UI CLI'
},
subCommands: {
init
make
}
})

View File

@@ -55,7 +55,7 @@ export interface ${upperName}Slots {
</script>
<script setup lang="ts">
import { Primitive } from 'radix-vue'
import { Primitive } from 'reka-ui'
const props = withDefaults(defineProps<${upperName}Props>(), { as: 'div' })
defineSlots<${upperName}Slots>()
@@ -72,7 +72,7 @@ const ui = ${camelName}()
: `
<script lang="ts">
import { tv, type VariantProps } from 'tailwind-variants'
import type { ${upperName}RootProps, ${upperName}RootEmits } from 'radix-vue'
import type { ${upperName}RootProps, ${upperName}RootEmits } from 'reka-ui'
import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config'
import theme from '#build/${path}/${prose ? 'prose/' : ''}${content ? 'content/' : ''}${kebabName}'
@@ -94,7 +94,7 @@ export interface ${upperName}Slots {}
</script>
<script setup lang="ts">
import { ${upperName}Root, useForwardPropsEmits } from 'radix-vue'
import { ${upperName}Root, useForwardPropsEmits } from 'reka-ui'
import { reactivePick } from '@vueuse/core'
const props = defineProps<${upperName}Props>()
@@ -149,7 +149,7 @@ import ComponentRender from '../${content ? '../' : ''}component-render'
describe('${upperName}', () => {
it.each([
// Props
['with as', { props: { as: 'div' } }],
['with as', { props: { as: 'section' } }],
['with class', { props: { class: '' } }],
['with ui', { props: { ui: {} } }],
// Slots
@@ -163,9 +163,54 @@ describe('${upperName}', () => {
}
}
const doc = ({ name, pro }) => {
const kebabName = kebabCase(name)
const upperName = splitByCase(name).map(p => upperFirst(p)).join('')
return {
filename: `docs/content/${pro ? 'pro' : '3.components'}/${kebabName}.md`,
contents: `---
description:
links: ${pro
? ''
: `
- label: ${upperName}
icon: i-custom-reka-ui
to: https://www.reka-ui.com/components/${kebabName}.html`}
- label: GitHub
icon: i-simple-icons-github
to: https://github.com/nuxt/${pro ? 'ui-pro' : 'ui'}/tree/v3/src/runtime/components/${upperName}.vue
---
## Usage
## Examples
## API
### Props
:component-props
### Slots
:component-slots
### Emits
:component-emits
## Theme
:component-theme
`
}
}
export default {
playground,
component,
theme,
test
test,
doc
}

View File

@@ -15,3 +15,17 @@ export async function appendFile(path, contents) {
await fsp.writeFile(path, file.trim() + '\n' + contents + '\n')
}
}
export function normalizeLocale(locale) {
if (!locale) {
return ''
}
if (locale.includes('_')) {
return locale.split('_')
.map((part, index) => index === 0 ? part.toLowerCase() : part.toUpperCase())
.join('-')
}
return locale.toLowerCase()
}

View File

@@ -168,7 +168,7 @@ const isDark = computed({
@import '@nuxt/ui';
@theme {
--font-family-sans: 'DM Sans', sans-serif;
--font-sans: 'DM Sans', sans-serif;
--color-primary-50: var(--ui-color-primary-50);
--color-primary-100: var(--ui-color-primary-100);

View File

@@ -18,7 +18,7 @@ onMounted(() => {
</script>
<template>
<div class="border rounded border-[var(--ui-border)]">
<div class="border rounded-[var(--ui-radius)] border-[var(--ui-border)]">
<div
ref="wrapper"
:class="['overflow-hidden', collapsed && overflow ? 'max-h-48' : 'max-h-none']"

View File

@@ -126,7 +126,7 @@ const previewUrl = computed(() => {
</div>
<div v-if="highlightedCode && formattedCode" v-show="rendererReady" class="relative w-full p-3">
<!-- eslint-disable vue/no-v-html -->
<pre class="p-4 min-h-40 max-h-72 text-sm overflow-y-auto rounded-lg border border-[var(--ui-border)] bg-neutral-50 dark:bg-neutral-800" v-html="highlightedCode" />
<pre class="p-4 min-h-40 max-h-72 text-sm overflow-y-auto rounded-[calc(var(--ui-radius)*1.5)] border border-[var(--ui-border)] bg-neutral-50 dark:bg-neutral-800" v-html="highlightedCode" />
<UButton
color="neutral"
variant="link"

View File

@@ -17,14 +17,14 @@ watchEffect(() => {
})
const description = computed(() => {
return props.meta.description?.replace(/`([^`]+)`/g, '<code class="font-medium bg-[var(--ui-bg-elevated)] px-1 py-0.5 rounded">$1</code>')
return props.meta.description?.replace(/`([^`]+)`/g, '<code class="font-medium bg-[var(--ui-bg-elevated)] px-1 py-0.5 rounded-[var(--ui-radius)]">$1</code>')
})
</script>
<template>
<UFormField :name="meta?.name" class="" :ui="{ wrapper: 'mb-2' }" :class="{ 'opacity-70 cursor-not-allowed': !matchedInput || ignore }">
<template #label>
<p v-if="meta?.name" class="font-mono font-bold px-1.5 py-0.5 border border-[var(--ui-border-accented)] border-dashed rounded bg-[var(--ui-bg-elevated)]">
<p v-if="meta?.name" class="font-mono font-bold px-1.5 py-0.5 border border-[var(--ui-border-accented)] border-dashed rounded-[var(--ui-radius)] bg-[var(--ui-bg-elevated)]">
{{ meta?.name }}
</p>
</template>

View File

@@ -12,8 +12,8 @@
"dependencies": {
"@nuxt/ui": "latest",
"knitwork": "^1.1.0",
"nuxt": "^3.14.159",
"prettier": "^3.3.3",
"nuxt": "^3.14.1592",
"prettier": "^3.4.2",
"zod": "^3.23.8"
}
}

View File

@@ -7,8 +7,10 @@ const route = useRoute()
const appConfig = useAppConfig()
const colorMode = useColorMode()
const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('content'))
const { data: files } = await useAsyncData('files', () => queryCollectionSearchSections('content', { ignoredTags: ['style'] }))
const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('content', ['framework', 'module']))
const { data: files } = useLazyAsyncData('search', () => queryCollectionSearchSections('content'), {
server: false
})
const searchTerm = ref('')
@@ -20,33 +22,31 @@ const searchTerm = ref('')
// useTrackEvent('Search', { props: { query: `${query} - ${searchTerm.value?.commandPaletteRef.results.length} results` } })
// }, 500))
const links = computed(() => {
return [{
label: 'Docs',
icon: 'i-lucide-book-open',
to: '/getting-started',
active: route.path.startsWith('/getting-started') || route.path.startsWith('/components')
}, ...(navigation.value?.find(item => item.path === '/pro')
? [{
label: 'Pro',
icon: 'i-lucide-layers-3',
to: '/pro',
active: route.path.startsWith('/pro/getting-started') || route.path.startsWith('/pro/components') || route.path.startsWith('/pro/prose')
}, {
label: 'Pricing',
icon: 'i-lucide-credit-card',
to: '/pro/pricing'
}, {
label: 'Templates',
icon: 'i-lucide-monitor',
to: '/pro/templates'
}]
: []), {
label: 'Releases',
icon: 'i-lucide-rocket',
to: '/releases'
}].filter(Boolean)
})
const links = computed(() => [{
label: 'Docs',
icon: 'i-lucide-square-play',
to: '/getting-started',
active: route.path.startsWith('/getting-started')
}, {
label: 'Components',
icon: 'i-lucide-square-code',
to: '/components',
active: route.path.startsWith('/components')
}, {
label: 'Roadmap',
icon: 'i-lucide-map',
to: '/roadmap'
}, {
label: 'Figma',
icon: 'i-lucide-figma',
to: 'https://www.figma.com/community/file/1288455405058138934',
target: '_blank'
}, {
label: 'Releases',
icon: 'i-lucide-rocket',
to: 'https://github.com/nuxt/ui/releases',
target: '_blank'
}].filter(Boolean))
const color = computed(() => colorMode.value === 'dark' ? (colors as any)[appConfig.ui.colors.neutral][900] : 'white')
const radius = computed(() => `:root { --ui-radius: ${appConfig.theme.radius}rem; }`)
@@ -73,19 +73,10 @@ useServerSeoMeta({
twitterCard: 'summary_large_image'
})
const updatedNavigation = computed(() => navigation.value?.map(item => ({
...item,
children: item.children?.map((child: typeof item) => ({
...child,
...(child.path === '/getting-started/installation' && {
title: 'Installation',
active: route.path.startsWith('/getting-started/installation'),
children: []
})
})) || []
})))
const { frameworks, modules } = useSharedData()
const { mappedNavigation, filteredNavigation } = useContentNavigation(navigation)
provide('navigation', updatedNavigation)
provide('navigation', mappedNavigation)
</script>
<template>
@@ -93,7 +84,7 @@ provide('navigation', updatedNavigation)
<NuxtLoadingIndicator color="#FFF" />
<template v-if="!route.path.startsWith('/examples')">
<Banner />
<!-- <Banner /> -->
<Header :links="links" />
</template>
@@ -103,10 +94,24 @@ provide('navigation', updatedNavigation)
</NuxtLayout>
<template v-if="!route.path.startsWith('/examples')">
<Footer />
<!-- <Footer /> -->
<ClientOnly>
<LazyUContentSearch v-model:search-term="searchTerm" :files="files" :navigation="navigation" :fuse="{ resultLimit: 42 }" />
<LazyUContentSearch
v-model:search-term="searchTerm"
:files="files"
:groups="[{
id: 'framework',
label: 'Framework',
items: frameworks
}, {
id: 'module',
label: 'Module',
items: modules
}]"
:navigation="filteredNavigation"
:fuse="{ resultLimit: 42 }"
/>
</ClientOnly>
</template>
</UApp>
@@ -116,10 +121,12 @@ provide('navigation', updatedNavigation)
@import "tailwindcss";
@import "@nuxt/ui-pro";
@source "../content/**/*.md";
@source "../content";
@theme {
--font-family-sans: 'Public Sans', sans-serif;
--container-8xl: 90rem;
--font-sans: 'Public Sans', sans-serif;
--color-green-50: #EFFDF5;
--color-green-100: #D9FBE8;
@@ -135,6 +142,13 @@ provide('navigation', updatedNavigation)
}
:root {
--ui-container-width: 90rem;
--ui-container: var(--container-8xl);
}
html[data-framework="nuxt"] .vue-only,
html[data-framework="vue"] .nuxt-only,
html[data-module="ui-pro"] .ui-only,
html[data-module="ui"] .ui-pro-only {
display: none;
}
</style>

View File

@@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 283.46 283.46">
<defs>
<style>
.cls-1{fill:#231815;}
@media (prefers-color-scheme: dark) { .cls-1{fill:#ffffff;} }
</style>
</defs>
<path class="cls-1" d="M144.89,89.86c-33.46,0-54.44,14.56-66.14,26.76a86,86,0,0,0-23.69,58.94c0,22.64,8.81,43.48,24.8,58.67,15.7,14.92,36.9,23.14,59.68,23.14,23.81,0,46-8.49,62.49-23.91,17-15.9,26.37-37.93,26.37-62C228.4,120.37,185.94,89.86,144.89,89.86Zm.49,153.67a61.49,61.49,0,0,1-46.45-20.4c-12.33-13.76-18.85-32.64-18.85-54.62,0-20.7,6.07-37.67,17.57-49.07,10.11-10,24.39-15.62,40.19-15.74,19,0,35.22,6.56,46.76,19,12.6,13.58,19.27,34,19.27,58.95C203.87,224.39,174.49,243.53,145.38,243.53Z"/>
<polygon class="cls-1" points="198.75 74.96 179.45 74.96 142.09 37.83 104.51 74.96 86.14 74.96 138.09 24.25 146.81 24.25 198.75 74.96"/>
</svg>

After

Width:  |  Height:  |  Size: 855 B

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -0,0 +1,23 @@
<script setup lang="ts">
const { framework, frameworks } = useSharedData()
const value = ref<string | undefined>(undefined)
onMounted(() => {
value.value = framework.value
})
</script>
<template>
<UTabs
v-model="value"
:items="frameworks"
:content="false"
color="neutral"
:ui="{
indicator: 'bg-[var(--ui-bg)]',
trigger: 'px-1 data-[state=active]:text-[var(--ui-text-highlighted)]'
}"
@update:model-value="(framework = $event as string)"
/>
</template>

View File

@@ -2,15 +2,16 @@
import type { ContentNavigationItem } from '@nuxt/content'
import type { NavigationMenuItem } from '@nuxt/ui'
defineProps<{
const props = defineProps<{
links: NavigationMenuItem[]
}>()
const config = useRuntimeConfig().public
const { module } = useSharedData()
const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
// const items = computed(() => props.links.map(({ icon, ...link }) => link))
const items = computed(() => props.links.map(({ icon, ...link }) => link))
defineShortcuts({
meta_g: () => {
@@ -20,16 +21,35 @@ defineShortcuts({
</script>
<template>
<UHeader :ui="{ left: 'min-w-0' }">
<UHeader :ui="{ left: 'min-w-0', toggle: '-mr-1.5' }" mode="drawer" :menu="{ shouldScaleBackground: true }">
<template #left>
<NuxtLink to="/" class="flex items-end gap-2 font-bold text-xl text-[var(--ui-text-highlighted)] min-w-0 focus-visible:outline-[var(--ui-primary)]" aria-label="Nuxt UI">
<Logo class="w-auto h-6 shrink-0" />
<UBadge :label="`v${config.version}`" variant="subtle" size="sm" class="-mb-[2px] rounded-[var(--ui-radius)] font-semibold inline-block truncate" />
<NuxtLink to="/" class="flex items-end gap-2 font-bold text-xl text-[var(--ui-text-highlighted)] min-w-0 focus-visible:outline-[var(--ui-primary)] shrink-0" aria-label="Nuxt UI">
<LogoPro class="w-auto h-6 shrink-0 ui-pro-only" />
<Logo class="w-auto h-6 shrink-0 ui-only" />
</NuxtLink>
<UDropdownMenu
v-slot="{ open }"
:modal="false"
:items="[{ label: `v${config.version}`, active: true, color: 'primary', checked: true, type: 'checkbox' }, { label: module === 'ui-pro' ? 'v1.5' : 'v2.19', to: module === 'ui-pro' ? 'https://ui.nuxt.com/pro' : 'https://ui.nuxt.com' }]"
:ui="{ content: 'w-(--reka-dropdown-menu-trigger-width) min-w-0' }"
size="xs"
>
<UButton
:label="`v${config.version}`"
variant="subtle"
trailing-icon="i-lucide-chevron-down"
size="xs"
class="-mb-[6px] font-semibold rounded-full truncate"
:class="[open && 'bg-[var(--ui-primary)]/15 ']"
:ui="{
trailingIcon: ['transition-transform duration-200', open ? 'rotate-180' : undefined].filter(Boolean).join(' ')
}"
/>
</UDropdownMenu>
</template>
<!-- <UNavigationMenu :items="items" variant="link" /> -->
<UNavigationMenu :items="items" variant="link" />
<template #right>
<ThemePicker />
@@ -38,11 +58,11 @@ defineShortcuts({
<UContentSearchButton />
</UTooltip>
<UTooltip text="Open on GitHub" :kbds="['meta', 'G']">
<UTooltip text="Open on GitHub" :kbds="['meta', 'G']" class="hidden lg:flex">
<UButton
color="neutral"
variant="ghost"
to="https://github.com/nuxt/ui/tree/v3"
to="https://github.com/nuxt/ui"
target="_blank"
icon="i-simple-icons-github"
aria-label="GitHub"
@@ -51,9 +71,14 @@ defineShortcuts({
</template>
<template #content>
<!-- <UNavigationMenu orientation="vertical" :items="items" class="-ml-2.5" />
<UNavigationMenu orientation="vertical" :items="links" class="-mx-2.5" />
<USeparator type="dashed" class="my-4" /> -->
<USeparator type="dashed" class="mt-4 mb-6" />
<div class="flex flex-col gap-2 w-[calc(100%+1.25rem)] mb-5.5 -mx-2.5">
<ModuleSelect />
<FrameworkSelect />
</div>
<UContentNavigation :navigation="navigation" highlight />
</template>

View File

@@ -0,0 +1,14 @@
<template>
<svg width="1352" height="200" viewBox="0 0 1352 200" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M377 200C379.16 200 381 198.209 381 196V103C381 103 386 112 395 127L434 194C435.785 197.74 439.744 200 443 200H470V50H443C441.202 50 439 51.4941 439 54V148L421 116L385 55C383.248 51.8912 379.479 50 376 50H350V200H377Z" fill="currentColor" />
<path d="M726 92H739C742.314 92 745 89.3137 745 86V60H773V92H800V116H773V159C773 169.5 778.057 174 787 174H800V200H783C759.948 200 745 185.071 745 160V116H726V92Z" fill="currentColor" />
<path d="M591 92V154C591 168.004 585.742 179.809 578 188C570.258 196.191 559.566 200 545 200C530.434 200 518.742 196.191 511 188C503.389 179.809 498 168.004 498 154V92H514C517.412 92 520.769 92.622 523 95C525.231 97.2459 526 98.5652 526 102V154C526 162.059 526.457 167.037 530 171C533.543 174.831 537.914 176 545 176C552.217 176 555.457 174.831 559 171C562.543 167.037 563 162.059 563 154V102C563 98.5652 563.769 96.378 566 94C567.96 91.9107 570.028 91.9599 573 92C573.411 92.0055 574.586 92 575 92H591Z" fill="currentColor" />
<path d="M676 144L710 92H684C680.723 92 677.812 93.1758 676 96L660 120L645 97C643.188 94.1758 639.277 92 636 92H611L645 143L608 200H634C637.25 200 640.182 196.787 642 194L660 167L679 195C680.818 197.787 683.75 200 687 200H713L676 144Z" fill="currentColor" />
<path d="M168 200H279C282.542 200 285.932 198.756 289 197C292.068 195.244 295.23 193.041 297 190C298.77 186.959 300.002 183.51 300 179.999C299.998 176.488 298.773 173.04 297 170.001L222 41C220.23 37.96 218.067 35.7552 215 34C211.933 32.2448 207.542 31 204 31C200.458 31 197.067 32.2448 194 34C190.933 35.7552 188.77 37.96 187 41L168 74L130 9.99764C128.228 6.95784 126.068 3.75491 123 2C119.932 0.245087 116.542 0 113 0C109.458 0 106.068 0.245087 103 2C99.9323 3.75491 96.7717 6.95784 95 9.99764L2 170.001C0.226979 173.04 0.00154312 176.488 1.90993e-06 179.999C-0.0015393 183.51 0.229648 186.959 2 190C3.77035 193.04 6.93245 195.244 10 197C13.0675 198.756 16.4578 200 20 200H90C117.737 200 137.925 187.558 152 164L186 105L204 74L259 168H186L168 200ZM89 168H40L113 42L150 105L125.491 147.725C116.144 163.01 105.488 168 89 168Z" fill="var(--ui-primary)" />
<path d="M958 60.0001H938C933.524 60.0001 929.926 59.9395 927 63C924.074 65.8905 925 67.5792 925 72V141C925 151.372 923.648 156.899 919 162C914.352 166.931 908.468 169 899 169C889.705 169 882.648 166.931 878 162C873.352 156.899 873 151.372 873 141V72.0001C873 67.5793 872.926 65.8906 870 63.0001C867.074 59.9396 863.476 60.0001 859 60.0001H840V141C840 159.023 845.016 173.458 855 184C865.156 194.542 879.893 200 899 200C918.107 200 932.844 194.542 943 184C953.156 173.458 958 159.023 958 141V60.0001Z" fill="currentColor" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M1000 60.0233L1020 60V77L1020 128V156.007L1020 181L1020 189.004C1020 192.938 1019.98 194.429 1017 197.001C1014.02 199.725 1009.56 200 1005 200H986.001V181.006L986 130.012V70.0215C986 66.1576 986.016 64.5494 989 62.023C991.819 59.6358 995.437 60.0233 1000 60.0233Z" fill="currentColor" />
<path d="M1060 200V60H1117C1126.67 60 1134.98 61.2896 1142 65C1149.16 68.7104 1155.29 74.3744 1159 81C1162.71 87.6256 1164 95.3867 1164 104C1164 112.481 1162.71 120.374 1159 127C1155.29 133.626 1149.16 138.157 1142 142C1134.98 145.71 1126.67 148 1117 148H1090V200H1060ZM1115 123C1121.63 123 1126.69 121.578 1130 118C1133.31 114.29 1135 109.433 1135 104C1135 98.567 1133.31 93.5778 1130 90C1126.69 86.2896 1121.63 85 1115 85H1090V123H1115Z" fill="var(--ui-primary)" />
<path d="M1226 123C1219.37 123 1214.31 124.965 1211 130C1207.69 135.035 1206 142.122 1206 151V200H1178V100H1200C1203.31 100 1206 102.686 1206 106V116C1208.65 109.904 1211.16 106.518 1215 104C1218.98 101.482 1224.77 100 1231 100H1242V123H1226Z" fill="var(--ui-primary)" />
<path d="M1299 200C1288.93 200 1280.08 197.373 1272 193C1263.92 188.495 1257.51 182.818 1253 175C1248.49 167.049 1246 157.806 1246 148C1246 138.194 1248.49 129.818 1253 122C1257.51 114.049 1263.92 107.373 1272 103C1280.08 98.4946 1288.93 97 1299 97C1309.07 97 1318.92 98.4946 1327 103C1335.08 107.373 1340.49 114.049 1345 122C1349.51 129.818 1352 138.194 1352 148C1352 157.806 1349.51 167.049 1345 175C1340.49 182.818 1335.08 188.495 1327 193C1318.92 197.373 1309.07 200 1299 200ZM1299 176C1306.42 176 1312.36 173.168 1317 168C1321.64 162.832 1324 156.216 1324 148C1324 139.652 1321.64 133.168 1317 128C1312.36 122.832 1306.42 120 1299 120C1291.58 120 1285.64 122.832 1281 128C1276.36 133.168 1274 139.652 1274 148C1274 156.216 1276.36 162.832 1281 168C1285.64 173.168 1291.58 176 1299 176Z" fill="var(--ui-primary)" />
</svg>
</template>

View File

@@ -0,0 +1,20 @@
<script setup lang="ts">
const { module, modules } = useSharedData()
const value = ref<string | undefined>(undefined)
onMounted(() => {
value.value = module.value
})
</script>
<template>
<UTabs
v-model="value"
:items="modules"
:content="false"
color="neutral"
:ui="{ indicator: 'bg-[var(--ui-bg)]', trigger: 'px-1 data-[state=active]:text-[var(--ui-text-highlighted)]' }"
@update:model-value="(module = $event as string)"
/>
</template>

View File

@@ -3,9 +3,42 @@
import json5 from 'json5'
import { upperFirst, camelCase, kebabCase } from 'scule'
import { hash } from 'ohash'
import { CalendarDate } from '@internationalized/date'
import * as theme from '#build/ui'
import { get, set } from '#ui/utils'
interface Cast {
get: (args: any) => any
template: (args: any) => string
}
type CastDateValue = [number, number, number]
const castMap: Record<string, Cast> = {
'DateValue': {
get: (args: CastDateValue) => new CalendarDate(...args),
template: (value: CalendarDate) => {
return value ? `new CalendarDate(${value.year}, ${value.month}, ${value.day})` : 'null'
}
},
'DateValue[]': {
get: (args: CastDateValue[]) => args.map(date => new CalendarDate(...date)),
template: (value: CalendarDate[]) => {
return value ? `[${value.map(date => `new CalendarDate(${date.year}, ${date.month}, ${date.day})`).join(', ')}]` : '[]'
}
},
'DateRange': {
get: (args: { start: CastDateValue, end: CastDateValue }) => ({ start: new CalendarDate(...args.start), end: new CalendarDate(...args.end) }),
template: (value: { start: CalendarDate, end: CalendarDate }) => {
if (!value.start || !value.end) {
return `{ start: null, end: null }`
}
return `{ start: new CalendarDate(${value.start.year}, ${value.start.month}, ${value.start.day}), end: new CalendarDate(${value.end.year}, ${value.end.month}, ${value.end.day}) }`
}
}
}
const props = defineProps<{
/** Override the slug taken from the route */
slug?: string
@@ -18,6 +51,8 @@ const props = defineProps<{
external?: string[]
/** List of props to use with `v-model` */
model?: string[]
/** List of props to cast from code and selection */
cast?: { [key: string]: string }
/** List of items for each prop */
items?: { [key: string]: string[] }
props?: { [key: string]: any }
@@ -45,7 +80,17 @@ const camelName = camelCase(props.slug ?? route.params.slug?.[route.params.slug.
const name = `U${upperFirst(camelName)}`
const component = defineAsyncComponent(() => import(`#ui/components/${upperFirst(camelName)}.vue`))
const componentProps = reactive({ ...(props.props || {}) })
const componentProps = reactive({
...Object.fromEntries(Object.entries(props.props || {}).map(([key, value]) => {
const cast = props.cast?.[key]
if (cast && !castMap[cast]) {
throw new Error(`Unknown cast: ${cast}`)
}
return [key, cast ? castMap[cast]!.get(value) : value]
}))
})
const componentEvents = reactive({
...Object.fromEntries((props.model || []).map(key => [`onUpdate:${key}`, (e: any) => setComponentProp(key, e)])),
...(componentProps.modelValue ? { [`onUpdate:modelValue`]: (e: any) => setComponentProp('modelValue', e) } : {})
@@ -96,7 +141,7 @@ const options = computed(() => {
return {
name: key,
label: key,
type: prop?.type,
type: props?.cast?.[key] ?? prop?.type,
items
}
})
@@ -117,7 +162,10 @@ const code = computed(() => {
<script setup lang="ts">
`
for (const key of props.external) {
code += `const ${key === 'modelValue' ? 'value' : key} = ref(${json5.stringify(componentProps[key], null, 2).replace(/,([ |\t\n]+[}|\]])/g, '$1')})
const cast = props.cast?.[key]
const value = cast ? castMap[cast]!.template(componentProps[key]) : json5.stringify(componentProps[key], null, 2).replace(/,([ |\t\n]+[}|\]])/g, '$1')
code += `const ${key === 'modelValue' ? 'value' : key} = ref(${value})
`
}
code += `<\/script>
@@ -164,7 +212,7 @@ const code = computed(() => {
continue
}
code += ` ${prop?.type.includes('number') ? ':' : ''}${name}="${value}"`
code += ` ${typeof value === 'number' ? ':' : ''}${name}="${value}"`
}
}
@@ -220,7 +268,7 @@ const { data: ast } = await useAsyncData(`component-code-${name}-${hash({ props:
<template>
<div class="my-5">
<div>
<div v-if="options.length" class="flex items-center gap-2.5 border border-[var(--ui-color-neutral-200)] dark:border-[var(--ui-color-neutral-700)] border-b-0 relative rounded-t-[calc(var(--ui-radius)*1.5)] px-4 py-2.5 overflow-x-auto">
<div v-if="options.length" class="flex items-center gap-2.5 border border-[var(--ui-border-muted)] border-b-0 relative rounded-t-[calc(var(--ui-radius)*1.5)] px-4 py-2.5 overflow-x-auto">
<template v-for="option in options" :key="option.name">
<UFormField
:label="option.label"
@@ -232,7 +280,7 @@ const { data: ast } = await useAsyncData(`component-code-${name}-${hash({ props:
container: 'mt-0'
}"
>
<USelectMenu
<USelect
v-if="option.items?.length"
:model-value="getComponentProp(option.name)"
:items="option.items"
@@ -240,7 +288,6 @@ const { data: ast } = await useAsyncData(`component-code-${name}-${hash({ props:
color="neutral"
variant="soft"
class="rounded-[var(--ui-radius)] rounded-l-none min-w-12"
:search-input="false"
:class="[option.name.toLowerCase().endsWith('color') && 'pl-6']"
:ui="{ itemLeadingChip: 'size-2' }"
@update:model-value="setComponentProp(option.name, $event)"
@@ -255,7 +302,7 @@ const { data: ast } = await useAsyncData(`component-code-${name}-${hash({ props:
class="size-2"
/>
</template>
</USelectMenu>
</USelect>
<UInput
v-else
:type="option.type?.includes('number') ? 'number' : 'text'"
@@ -269,12 +316,12 @@ const { data: ast } = await useAsyncData(`component-code-${name}-${hash({ props:
</template>
</div>
<div v-if="component" class="flex justify-center border border-b-0 border-[var(--ui-color-neutral-200)] dark:border-[var(--ui-color-neutral-700)] relative p-4 z-[1]" :class="[!options.length && 'rounded-t-[calc(var(--ui-radius)*1.5)]', props.class]">
<div v-if="component" class="flex justify-center border border-b-0 border-[var(--ui-border-muted)] relative p-4 z-[1]" :class="[!options.length && 'rounded-t-[calc(var(--ui-radius)*1.5)]', props.class]">
<component :is="component" v-bind="{ ...componentProps, ...componentEvents }">
<template v-for="slot in Object.keys(slots || {})" :key="slot" #[slot]>
<MDCSlot :name="slot" unwrap="p">
<slot :name="slot" mdc-unwrap="p">
{{ slots?.[slot] }}
</MDCSlot>
</slot>
</template>
</component>
</div>

View File

@@ -117,8 +117,8 @@ const optionsValues = ref(props.options?.reduce((acc, option) => {
<template>
<div class="my-5">
<template v-if="preview">
<div class="border border-[var(--ui-color-neutral-200)] dark:border-[var(--ui-color-neutral-700)] relative z-[1]" :class="[{ 'border-b-0 rounded-t-[calc(var(--ui-radius)*1.5)]': props.source, 'rounded-[calc(var(--ui-radius)*1.5)]': !props.source }]">
<div v-if="props.options?.length || !!slots.options" class="flex gap-4 p-4 border-b border-[var(--ui-color-neutral-200)] dark:border-[var(--ui-color-neutral-700)]">
<div class="border border-[var(--ui-border-muted)] relative z-[1]" :class="[{ 'border-b-0 rounded-t-[calc(var(--ui-radius)*1.5)]': props.source, 'rounded-[calc(var(--ui-radius)*1.5)]': !props.source }]">
<div v-if="props.options?.length || !!slots.options" class="flex gap-4 p-4 border-b border-[var(--ui-border-muted)]">
<slot name="options" />
<UFormField

View File

@@ -2,9 +2,11 @@
import { upperFirst, camelCase } from 'scule'
import type { ComponentMeta } from 'vue-component-meta'
import * as theme from '#build/ui'
import * as themePro from '#build/ui-pro'
const props = withDefaults(defineProps<{
ignore?: string[]
pro?: boolean
}>(), {
ignore: () => [
'activeClass',
@@ -32,7 +34,7 @@ const route = useRoute()
const camelName = camelCase(route.params.slug?.[route.params.slug.length - 1] ?? '')
const name = `U${upperFirst(camelName)}`
const componentTheme = (theme as any)[camelName]
const componentTheme = ((props.pro ? themePro : theme) as any)[camelName]
const meta = await fetchComponentMeta(name as any)
const metaProps: ComputedRef<ComponentMeta['props']> = computed(() => {

View File

@@ -35,7 +35,7 @@ const schemaProps = computed(() => {
</script>
<template>
<Collapsible v-if="schemaProps?.length" class="mt-1">
<ProseCollapsible v-if="schemaProps?.length" class="mt-1">
<ProseUl>
<ProseLi v-for="schemaProp in schemaProps" :key="schemaProp.name">
<HighlightInlineType :type="`${schemaProp.name}${schemaProp.required === false ? '?' : ''}: ${schemaProp.type}`" />
@@ -43,5 +43,5 @@ const schemaProps = computed(() => {
<MDC v-if="schemaProp.description" :value="schemaProp.description" class="text-[var(--ui-text-muted)] my-1" />
</ProseLi>
</ProseUl>
</Collapsible>
</ProseCollapsible>
</template>

View File

@@ -2,16 +2,26 @@
import json5 from 'json5'
import { camelCase } from 'scule'
import * as theme from '#build/ui'
import * as themePro from '#build/ui-pro'
const props = defineProps<{
pro?: boolean
}>()
const route = useRoute()
const { framework } = useSharedData()
const name = camelCase(route.params.slug?.[route.params.slug.length - 1] ?? '')
const strippedCompoundVariants = ref(false)
function stripCompoundVariants(component?: any) {
if (component?.compoundVariants) {
component.compoundVariants = component.compoundVariants.filter((compoundVariant: any) => {
const strippedTheme = computed(() => {
const strippedTheme = {
...((props.pro ? themePro : theme) as any)[name]
}
if (strippedTheme?.compoundVariants) {
strippedTheme.compoundVariants = strippedTheme.compoundVariants.filter((compoundVariant: any) => {
if (compoundVariant.color) {
if (!['primary', 'neutral'].includes(compoundVariant.color)) {
strippedCompoundVariants.value = true
@@ -40,26 +50,47 @@ function stripCompoundVariants(component?: any) {
})
}
return component
}
return strippedTheme
})
const component = computed(() => {
return {
ui: {
[name]: stripCompoundVariants((theme as any)[name])
[props.pro ? 'uiPro' : 'ui']: {
[name]: strippedTheme.value
}
}
})
const { data: ast } = await useAsyncData(`component-theme-${name}`, async () => {
const md = `
::code-collapse
::code-collapse{class="nuxt-only"}
\`\`\`ts [app.config.ts]
export default defineAppConfig(${json5.stringify(component.value, null, 2).replace(/,([ |\t\n]+[}|\])])/g, '$1')})
\`\`\`\
::
::code-collapse{class="vue-only"}
\`\`\`ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'
export default defineConfig({
plugins: [
vue(),
ui(${json5.stringify(component.value, null, 2).replace(/,([ |\t\n]+[}|\])])/g, '$1')
.split('\n')
.map((line, i) => i === 0 ? line : ` ${line}`)
.join('\n')})
]
})
\`\`\`
::
${strippedCompoundVariants.value
? `
::callout{icon="i-simple-icons-github" to="https://github.com/nuxt/ui/blob/v3/src/theme/${name}.ts"}
@@ -69,7 +100,7 @@ Some colors in \`compoundVariants\` are omitted for readability. Check out the s
`
return parseMarkdown(md)
})
}, { watch: [framework] })
</script>
<template>

View File

@@ -0,0 +1,12 @@
<script setup lang="ts">
import { Slot } from 'reka-ui'
</script>
<template>
<Slot class="nuxt-only">
<slot name="nuxt" />
</Slot>
<Slot class="vue-only">
<slot name="vue" />
</Slot>
</template>

View File

@@ -2,8 +2,13 @@
import json5 from 'json5'
import icons from '../../../../src/theme/icons'
const appConfig = useAppConfig()
const { framework, module } = useSharedData()
const { data: ast } = await useAsyncData(`icons-theme`, async () => {
const md = `
::code-collapse{class="ui-only nuxt-only"}
\`\`\`ts [app.config.ts]
export default defineAppConfig(${json5.stringify({
ui: {
@@ -11,10 +16,52 @@ export default defineAppConfig(${json5.stringify({
}
}, null, 2).replace(/,([ |\t\n]+[}|\])])/g, '$1')})
\`\`\`\
::
::code-collapse{class="ui-pro-only nuxt-only"}
\`\`\`ts [app.config.ts]
export default defineAppConfig(${json5.stringify({
ui: {
icons: appConfig.ui.icons
}
}, null, 2).replace(/,([ |\t\n]+[}|\])])/g, '$1')})
\`\`\`\
::
::caution{class="ui-pro-only vue-only"}
Nuxt UI Pro v3 does not support Vue yet.
::
::code-collapse{class="vue-only"}
\`\`\`ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'
export default defineConfig({
plugins: [
vue(),
ui(${json5.stringify({
ui: {
icons
}
}, null, 2).replace(/,([ |\t\n]+[}|\])])/g, '$1')
.split('\n')
.map((line, i) => i === 0 ? line : ` ${line}`)
.join('\n')})
]
})
\`\`\`
::
`
return parseMarkdown(md)
})
}, { watch: [framework, module] })
</script>
<template>

View File

@@ -0,0 +1,12 @@
<script setup lang="ts">
import { Slot } from 'reka-ui'
</script>
<template>
<Slot class="ui-only">
<slot name="ui" />
</Slot>
<Slot class="ui-pro-only">
<slot name="ui-pro" />
</Slot>
</template>

View File

@@ -0,0 +1,66 @@
<script setup lang="ts">
import * as locales from '@nuxt/ui/locale'
const props = withDefaults(defineProps<{
default?: string
}>(), {
default: 'en'
})
function getEmojiFlag(locale: string): string {
// Map language codes to default country codes
const languageToCountry: Record<string, string> = {
en: 'gb',
ar: 'sa',
cs: 'cz',
zh: 'cn',
ja: 'jp',
ko: 'kr'
}
// Get base language code before any region specifier
const baseLanguage = locale.split('-')[0]?.toLowerCase() || locale
// Use mapped country code or extract from locale if it contains a region
const countryCode = languageToCountry[baseLanguage] || locale.replace(/^.*-/, '').slice(0, 2)
return countryCode
.split('')
.map((char: string) => {
const codePoint = char.toUpperCase().codePointAt(0)
return codePoint ? String.fromCodePoint(0x1F1A5 + codePoint) : ''
})
.join('')
}
</script>
<!-- eslint-disable vue/singleline-html-element-content-newline -->
<template>
<div>
<ProseP>
By default, the <ProseCode>{{ props.default }}</ProseCode> locale is used.
</ProseP>
<div class="grid gap-6 grid-cols-2 md:grid-cols-3">
<div v-for="locale in locales" :key="locale.code">
<div class="flex gap-3 items-center">
<UAvatar size="xl">
{{ getEmojiFlag(locale.code) }}
</UAvatar>
<div class="text-sm">
<div class="font-semibold">{{ locale.name }}</div>
<div class="mt-1">Code: <ProseCode class="text-xs">{{ locale.code }}</ProseCode></div>
</div>
</div>
</div>
</div>
<ProseNote to="https://github.com/nuxt/ui/tree/v3/src/runtime/locale" target="_blank">
If you need additional languages, you can contribute by creating a PR to add a new locale in <ProseCode>src/runtime/locale/</ProseCode>.
</ProseNote>
<ProseTip>
You can use the <ProseCode>nuxt-ui</ProseCode> CLI to create a new locale:
<ProsePre language="bash">nuxt-ui make locale --code "en" --name "English"</ProsePre>
</ProseTip>
</div>
</template>

View File

@@ -0,0 +1,21 @@
<script setup lang="ts">
import { CalendarDate, DateFormatter, getLocalTimeZone } from '@internationalized/date'
const df = new DateFormatter('en-US', {
dateStyle: 'medium'
})
const modelValue = shallowRef(new CalendarDate(2022, 1, 10))
</script>
<template>
<UPopover>
<UButton color="neutral" variant="subtle" icon="i-lucide-calendar">
{{ df.format(modelValue.toDate(getLocalTimeZone())) }}
</UButton>
<template #content>
<UCalendar v-model="modelValue" class="p-2" />
</template>
</UPopover>
</template>

View File

@@ -0,0 +1,35 @@
<script setup lang="ts">
import { CalendarDate, DateFormatter, getLocalTimeZone } from '@internationalized/date'
const df = new DateFormatter('en-US', {
dateStyle: 'medium'
})
const modelValue = shallowRef({
start: new CalendarDate(2022, 1, 20),
end: new CalendarDate(2022, 2, 10)
})
</script>
<template>
<UPopover>
<UButton color="neutral" variant="subtle" icon="i-lucide-calendar">
<template v-if="modelValue.start">
<template v-if="modelValue.end">
{{ df.format(modelValue.start.toDate(getLocalTimeZone())) }} - {{ df.format(modelValue.end.toDate(getLocalTimeZone())) }}
</template>
<template v-else>
{{ df.format(modelValue.start.toDate(getLocalTimeZone())) }}
</template>
</template>
<template v-else>
Pick a date
</template>
</UButton>
<template #content>
<UCalendar v-model="modelValue" class="p-2" :number-of-months="2" range />
</template>
</UPopover>
</template>

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
import { CalendarDate } from '@internationalized/date'
import type { Matcher } from 'reka-ui/date'
const modelValue = shallowRef({
start: new CalendarDate(2022, 1, 1),
end: new CalendarDate(2022, 1, 9)
})
const isDateDisabled: Matcher = (date) => {
return date.day >= 10 && date.day <= 16
}
</script>
<template>
<UCalendar v-model="modelValue" :is-date-disabled="isDateDisabled" range />
</template>

View File

@@ -0,0 +1,30 @@
<script setup lang="ts">
import { CalendarDate } from '@internationalized/date'
const modelValue = shallowRef(new CalendarDate(2022, 1, 10))
function getColorByDate(date: Date) {
const isWeekend = date.getDay() % 6 == 0
const isDayMeeting = date.getDay() % 3 == 0
if (isWeekend) {
return undefined
}
if (isDayMeeting) {
return 'error'
}
return 'success'
}
</script>
<template>
<UCalendar v-model="modelValue">
<template #day="{ day }">
<UChip :show="!!getColorByDate(day.toDate('UTC'))" :color="getColorByDate(day.toDate('UTC'))" size="2xs">
{{ day.day }}
</UChip>
</template>
</UCalendar>
</template>

View File

@@ -0,0 +1,11 @@
<script setup lang="ts">
import { CalendarDate } from '@internationalized/date'
const modelValue = shallowRef(new CalendarDate(2023, 9, 10))
const minDate = new CalendarDate(2023, 9, 1)
const maxDate = new CalendarDate(2023, 9, 30)
</script>
<template>
<UCalendar v-model="modelValue" :min-value="minDate" :max-value="maxDate" />
</template>

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
import { CalendarDate } from '@internationalized/date'
import type { Matcher } from 'reka-ui/date'
const modelValue = shallowRef({
start: new CalendarDate(2022, 1, 1),
end: new CalendarDate(2022, 1, 9)
})
const isDateUnavailable: Matcher = (date) => {
return date.day >= 10 && date.day <= 16
}
</script>
<template>
<UCalendar v-model="modelValue" :is-date-unavailable="isDateUnavailable" range />
</template>

View File

@@ -0,0 +1,19 @@
<script setup lang="ts">
const color = ref('#00C16A')
const chip = computed(() => ({ backgroundColor: color.value }))
</script>
<template>
<UPopover>
<UButton label="Choose color" color="neutral" variant="outline">
<template #leading>
<span :style="chip" class="size-3 rounded-full" />
</template>
</UButton>
<template #content>
<UColorPicker v-model="color" class="p-2" />
</template>
</UPopover>
</template>

View File

@@ -14,7 +14,7 @@ const groups = computed(() => [{
id: 'users',
label: searchTerm.value ? `Users matching “${searchTerm.value}”...` : 'Users',
items: users.value || [],
filter: false
ignoreFilter: true
}])
</script>

View File

@@ -11,8 +11,8 @@ const items = [
level: 2
},
{
id: '/getting-started#radix-vue-3',
label: 'Radix Vue',
id: '/getting-started#reka-ui-radix-vue',
label: 'Reka UI',
level: 3
},
{

View File

@@ -72,7 +72,7 @@ const users = [
}
]
const searchTerm = ref('')
const searchTerm = ref('B')
function onSelect() {
searchTerm.value = ''

View File

@@ -32,7 +32,7 @@ const items = computed(() => [{
</script>
<template>
<UContextMenu :items="items" class="w-48">
<UContextMenu :items="items" :ui="{ content: 'w-48' }">
<div class="flex items-center justify-center rounded-md border border-dashed border-[var(--ui-border-accented)] text-sm aspect-video w-72">
Right click here
</div>

View File

@@ -25,7 +25,7 @@ const items = [
</script>
<template>
<UContextMenu :items="items" class="w-48">
<UContextMenu :items="items" :ui="{ content: 'w-48' }">
<div class="flex items-center justify-center rounded-md border border-dashed border-[var(--ui-border-accented)] text-sm aspect-video w-72">
Right click here
</div>

View File

@@ -12,7 +12,7 @@ const items = [{
</script>
<template>
<UContextMenu :items="items" class="w-48">
<UContextMenu :items="items" :ui="{ content: 'w-48' }">
<div class="flex items-center justify-center rounded-md border border-dashed border-[var(--ui-border-accented)] text-sm aspect-video w-72">
Right click here
</div>
@@ -22,7 +22,7 @@ const items = [{
</template>
<template #refresh-trailing>
<UIcon v-if="loading" name="i-lucide-refresh-ccw" class="shrink-0 size-5 text-[var(--ui-primary)] animate-spin" />
<UIcon v-if="loading" name="i-lucide-refresh-cw" class="shrink-0 size-5 text-[var(--ui-primary)] animate-spin" />
</template>
</UContextMenu>
</template>

View File

@@ -13,7 +13,7 @@ const groups = computed(() => [{
id: 'users',
label: searchTerm.value ? `Users matching “${searchTerm.value}”...` : 'Users',
items: users.value || [],
filter: false
ignoreFilter: true
}])
</script>

View File

@@ -40,7 +40,7 @@ const items = computed(() => [{
</script>
<template>
<UDropdownMenu :items="items" :content="{ align: 'start' }" class="w-48">
<UDropdownMenu :items="items" :content="{ align: 'start' }" :ui="{ content: 'w-48' }">
<UButton label="Open" color="neutral" variant="outline" icon="i-lucide-menu" />
</UDropdownMenu>
</template>

View File

@@ -25,7 +25,7 @@ const items = [
</script>
<template>
<UDropdownMenu :items="items" class="w-48">
<UDropdownMenu :items="items" :ui="{ content: 'w-48' }">
<UButton label="Open" color="neutral" variant="outline" icon="i-lucide-menu" />
<template #profile-trailing>

View File

@@ -13,7 +13,7 @@ const items = [{
</script>
<template>
<UDropdownMenu :items="items" class="w-48">
<UDropdownMenu :items="items" :ui="{ content: 'w-48' }">
<UButton label="Open" color="neutral" variant="outline" icon="i-lucide-menu" />
<template #profile-trailing>

View File

@@ -18,7 +18,7 @@ const items = [{
</script>
<template>
<UDropdownMenu v-model:open="open" :items="items" class="w-48">
<UDropdownMenu v-model:open="open" :items="items" :ui="{ content: 'w-48' }">
<UButton label="Open" color="neutral" variant="outline" icon="i-lucide-menu" />
</UDropdownMenu>
</template>

View File

@@ -4,6 +4,7 @@ import type { FormSubmitEvent } from '@nuxt/ui'
const schema = z.object({
input: z.string().min(10),
inputNumber: z.number().min(10),
inputMenu: z.any().refine(option => option?.value === 'option-2', {
message: 'Select Option 2'
}),
@@ -29,10 +30,11 @@ const schema = z.object({
radioGroup: z.string().refine(value => value === 'option-2', {
message: 'Select Option 2'
}),
slider: z.number().max(20, { message: 'Must be less than 20' })
slider: z.number().max(20, { message: 'Must be less than 20' }),
pin: z.string().regex(/^\d$/).array().length(5)
})
type Schema = z.output<typeof schema>
type Schema = z.input<typeof schema>
const state = reactive<Partial<Schema>>({})
@@ -52,10 +54,10 @@ async function onSubmit(event: FormSubmitEvent<any>) {
</script>
<template>
<UForm ref="form" :state="state" :schema="schema" @submit="onSubmit">
<UForm ref="form" :state="state" :schema="schema" class="w-full" @submit="onSubmit">
<div class="grid grid-cols-3 gap-4">
<UFormField label="Input" name="input">
<UInput v-model="state.input" placeholder="john@lennon.com" class="w-40" />
<UInput v-model="state.input" placeholder="john@lennon.com" class="w-full" />
</UFormField>
<div class="flex flex-col gap-4">
@@ -73,42 +75,48 @@ async function onSubmit(event: FormSubmitEvent<any>) {
</UFormField>
<UFormField name="select" label="Select">
<USelect v-model="state.select" :items="items" />
<USelect v-model="state.select" :items="items" class="w-full" />
</UFormField>
<UFormField name="selectMenu" label="Select Menu">
<USelectMenu v-model="state.selectMenu" :items="items" />
<USelectMenu v-model="state.selectMenu" :items="items" class="w-full" />
</UFormField>
<UFormField name="selectMenuMultiple" label="Select Menu (Multiple)">
<USelectMenu v-model="state.selectMenuMultiple" multiple :items="items" />
<USelectMenu v-model="state.selectMenuMultiple" multiple :items="items" class="w-full" />
</UFormField>
<UFormField name="inputMenu" label="Input Menu">
<UInputMenu v-model="state.inputMenu" :items="items" />
<UInputMenu v-model="state.inputMenu" :items="items" class="w-full" />
</UFormField>
<UFormField name="inputMenuMultiple" label="Input Menu (Multiple)">
<UInputMenu v-model="state.inputMenuMultiple" multiple :items="items" />
<UInputMenu v-model="state.inputMenuMultiple" multiple :items="items" class="w-full" />
</UFormField>
<span />
<UFormField name="inputNumber" label="Input Number">
<UInputNumber v-model="state.inputNumber" class="w-full" />
</UFormField>
<UFormField label="Textarea" name="textarea">
<UTextarea v-model="state.textarea" />
<UTextarea v-model="state.textarea" class="w-full" />
</UFormField>
<UFormField name="radioGroup">
<URadioGroup v-model="state.radioGroup" legend="Radio group" :items="items" />
</UFormField>
<UFormField name="pin" label="Pin Input" :error-pattern="/(pin)\..*/">
<UPinInput v-model="state.pin" />
</UFormField>
</div>
<div class="flex gap-2 mt-8">
<UButton color="neutral" type="submit">
<UButton type="submit">
Submit
</UButton>
<UButton color="neutral" variant="outline" @click="form?.clear()">
<UButton variant="outline" @click="form?.clear()">
Clear
</UButton>
</div>

View File

@@ -0,0 +1,39 @@
<script setup lang="ts">
const { data: countries, status, execute } = await useLazyFetch<{
name: string
code: string
emoji: string
}[]>('/api/countries.json', {
immediate: false
})
function onOpen() {
if (!countries.value?.length) {
execute()
}
}
</script>
<template>
<UInputMenu
:items="countries || []"
:loading="status === 'pending'"
label-key="name"
:search-input="{ icon: 'i-lucide-search' }"
placeholder="Select country"
class="w-48"
@update:open="onOpen"
>
<template #leading="{ modelValue, ui }">
<span v-if="modelValue" class="size-5 text-center">
{{ modelValue?.emoji }}
</span>
<UIcon v-else name="i-lucide-earth" :class="ui.leadingIcon()" />
</template>
<template #item-leading="{ item }">
<span class="size-5 text-center">
{{ item.emoji }}
</span>
</template>
</UInputMenu>
</template>

View File

@@ -0,0 +1,20 @@
<script setup lang="ts">
const items = ref(['Backlog', 'Todo', 'In Progress', 'Done'])
const value = ref('Backlog')
function onCreate(item: string) {
items.value.push(item)
value.value = item
}
</script>
<template>
<UInputMenu
v-model="value"
create-item
:items="items"
class="w-48"
@create="onCreate"
/>
</template>

View File

@@ -16,7 +16,7 @@ const { data: users, status } = await useFetch('https://jsonplaceholder.typicode
<UInputMenu
:items="users || []"
:loading="status === 'pending'"
:filter="['name', 'email']"
:filter-fields="['label', 'email']"
icon="i-lucide-user"
placeholder="Select user"
class="w-80"

View File

@@ -20,7 +20,7 @@ const { data: users, status } = await useFetch('https://jsonplaceholder.typicode
v-model:search-term="searchTerm"
:items="users || []"
:loading="status === 'pending'"
:filter="false"
ignore-filter
icon="i-lucide-user"
placeholder="Select user"
>

View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
const value = ref(1500)
</script>
<template>
<UInputNumber
v-model="value"
:format-options="{
style: 'currency',
currency: 'EUR',
currencyDisplay: 'code',
currencySign: 'accounting'
}"
/>
</template>

View File

@@ -0,0 +1,13 @@
<script setup lang="ts">
const value = ref(5)
</script>
<template>
<UInputNumber
v-model="value"
:format-options="{
signDisplay: 'exceptZero',
minimumFractionDigits: 1
}"
/>
</template>

View File

@@ -0,0 +1,9 @@
<script setup lang="ts">
const retries = ref(0)
</script>
<template>
<UFormField label="Retries" help="Specify number of attempts" required>
<UInputNumber v-model="retries" placeholder="Enter retries" />
</UFormField>
</template>

View File

@@ -0,0 +1,13 @@
<script setup lang="ts">
const value = ref(0.05)
</script>
<template>
<UInputNumber
v-model="value"
:step="0.01"
:format-options="{
style: 'percent'
}"
/>
</template>

View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
const value = ref(5)
</script>
<template>
<UInputNumber v-model="value">
<template #decrement>
<UButton size="xs" icon="i-lucide-minus" />
</template>
<template #increment>
<UButton size="xs" icon="i-lucide-plus" />
</template>
</UInputNumber>
</template>

View File

@@ -6,7 +6,7 @@ const value = ref('Click to clear')
<UInput
v-model="value"
placeholder="Type something..."
:ui="{ trailing: 'pr-0.5' }"
:ui="{ trailing: 'pe-1' }"
>
<template v-if="value?.length" #trailing>
<UButton

View File

@@ -0,0 +1,33 @@
<script setup lang="ts">
const value = ref('npx nuxi module add ui')
const copied = ref(false)
function copy() {
navigator.clipboard.writeText(value.value)
copied.value = true
setTimeout(() => {
copied.value = false
}, 2000)
}
</script>
<template>
<UInput
v-model="value"
:ui="{ trailing: 'pr-0.5' }"
>
<template v-if="value?.length" #trailing>
<UTooltip text="Copy to clipboard" :content="{ side: 'right' }">
<UButton
:color="copied ? 'success' : 'neutral'"
variant="link"
size="sm"
:icon="copied ? 'i-lucide-copy-check' : 'i-lucide-copy'"
aria-label="Copy to clipboard"
@click="copy"
/>
</UTooltip>
</template>
</UInput>
</template>

View File

@@ -0,0 +1,21 @@
<script setup lang="ts">
const input = useTemplateRef('input')
defineShortcuts({
'/': () => {
input.value?.inputRef?.focus()
}
})
</script>
<template>
<UInput
ref="input"
icon="i-lucide-search"
placeholder="Search..."
>
<template #trailing>
<UKbd value="/" />
</template>
</UInput>
</template>

View File

@@ -40,7 +40,7 @@ const text = computed(() => {
placeholder="Password"
:color="color"
:type="show ? 'text' : 'password'"
:ui="{ trailing: 'pr-0.5' }"
:ui="{ trailing: 'pe-1' }"
:aria-invalid="score < 4"
aria-describedby="password-strength"
class="w-full"

View File

@@ -8,7 +8,7 @@ const password = ref('password')
v-model="password"
placeholder="Password"
:type="show ? 'text' : 'password'"
:ui="{ trailing: 'pr-0.5' }"
:ui="{ trailing: 'pe-1' }"
>
<template #trailing>
<UButton

View File

@@ -13,7 +13,7 @@ const groups = computed(() => [{
id: 'users',
label: searchTerm.value ? `Users matching “${searchTerm.value}”...` : 'Users',
items: users.value || [],
filter: false
ignoreFilter: true
}])
</script>

View File

@@ -61,7 +61,7 @@ const items = [
:items="items"
class="justify-center"
:ui="{
viewport: 'sm:w-[var(--radix-navigation-menu-viewport-width)]',
viewport: 'sm:w-[var(--reka-navigation-menu-viewport-width)]',
childList: 'sm:w-96',
childLinkDescription: 'text-balance line-clamp-2'
}"

View File

@@ -0,0 +1,40 @@
<script setup lang="ts">
const { data: countries, status, execute } = await useLazyFetch<{
name: string
code: string
emoji: string
}[]>('/api/countries.json', {
immediate: false,
default: () => []
})
function onOpen() {
if (!countries.value?.length) {
execute()
}
}
</script>
<template>
<USelectMenu
:items="countries"
:loading="status === 'pending'"
label-key="name"
:search-input="{ icon: 'i-lucide-search' }"
placeholder="Select country"
class="w-48"
@update:open="onOpen"
>
<template #leading="{ modelValue, ui }">
<span v-if="modelValue" class="size-5 text-center">
{{ modelValue?.emoji }}
</span>
<UIcon v-else name="i-lucide-earth" :class="ui.leadingIcon()" />
</template>
<template #item-leading="{ item }">
<span class="size-5 text-center">
{{ item.emoji }}
</span>
</template>
</USelectMenu>
</template>

View File

@@ -0,0 +1,20 @@
<script setup lang="ts">
const items = ref(['Backlog', 'Todo', 'In Progress', 'Done'])
const value = ref('Backlog')
function onCreate(item: string) {
items.value.push(item)
value.value = item
}
</script>
<template>
<USelectMenu
v-model="value"
create-item
:items="items"
class="w-48"
@create="onCreate"
/>
</template>

View File

@@ -16,7 +16,7 @@ const { data: users, status } = await useFetch('https://jsonplaceholder.typicode
<USelectMenu
:items="users || []"
:loading="status === 'pending'"
:filter="['name', 'email']"
:filter-fields="['label', 'email']"
icon="i-lucide-user"
placeholder="Select user"
class="w-80"

View File

@@ -20,7 +20,7 @@ const { data: users, status } = await useFetch('https://jsonplaceholder.typicode
v-model:search-term="searchTerm"
:items="users || []"
:loading="status === 'pending'"
:filter="false"
ignore-filter
icon="i-lucide-user"
placeholder="Select user"
class="w-48"

View File

@@ -26,7 +26,7 @@ function getUserAvatar(value: string) {
<template #leading="{ modelValue, ui }">
<UAvatar
v-if="modelValue"
v-bind="getUserAvatar(modelValue)"
v-bind="getUserAvatar(modelValue as string)"
:size="ui.leadingAvatarSize()"
:class="ui.leadingAvatar()"
/>

View File

@@ -34,7 +34,7 @@ function getChip(value: string) {
<template #leading="{ modelValue, ui }">
<UChip
v-if="modelValue"
v-bind="getChip(modelValue)"
v-bind="getChip(modelValue as string)"
inset
standalone
:size="ui.itemLeadingChipSize()"

View File

@@ -0,0 +1,26 @@
<script setup lang="ts">
const items = [
{
title: 'Address',
description: 'Add your address here',
icon: 'i-lucide-house'
}, {
title: 'Shipping',
description: 'Set your preferred shipping method',
icon: 'i-lucide-truck'
}, {
title: 'Checkout',
description: 'Confirm your order'
}
]
</script>
<template>
<UStepper ref="stepper" :items="items" class="w-full">
<template #content="{ item }">
<Placeholder class="aspect-video">
This is the {{ item?.title }} step.
</Placeholder>
</template>
</UStepper>
</template>

View File

@@ -0,0 +1,41 @@
<script setup lang="ts">
const items = [
{
slot: 'address',
title: 'Address',
description: 'Add your address here',
icon: 'i-lucide-house'
}, {
slot: 'shipping',
title: 'Shipping',
description: 'Set your preferred shipping method',
icon: 'i-lucide-truck'
}, {
slot: 'checkout',
title: 'Checkout',
description: 'Confirm your order'
}
]
</script>
<template>
<UStepper :items="items" class="w-full">
<template #address>
<Placeholder class="aspect-video">
Address
</Placeholder>
</template>
<template #shipping>
<Placeholder class="aspect-video">
Shipping
</Placeholder>
</template>
<template #checkout>
<Placeholder class="aspect-video">
Checkout
</Placeholder>
</template>
</UStepper>
</template>

View File

@@ -0,0 +1,37 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
const items = [
{
title: 'Address',
description: 'Add your address here',
icon: 'i-lucide-house'
}, {
title: 'Shipping',
description: 'Set your preferred shipping method',
icon: 'i-lucide-truck'
}, {
title: 'Checkout',
description: 'Confirm your order'
}
]
const active = ref(0)
// Note: This is for demonstration purposes only. Don't do this at home.
onMounted(() => {
setInterval(() => {
active.value = (active.value + 1) % items.length
}, 2000)
})
</script>
<template>
<UStepper v-model="active" :items="items" class="w-full">
<template #content="{ item }">
<Placeholder class="aspect-video">
This is the {{ item?.title }} step.
</Placeholder>
</template>
</UStepper>
</template>

View File

@@ -0,0 +1,51 @@
<script setup lang="ts">
const items = [
{
slot: 'address',
title: 'Address',
description: 'Add your address here',
icon: 'i-lucide-house'
}, {
slot: 'shipping',
title: 'Shipping',
description: 'Set your preferred shipping method',
icon: 'i-lucide-truck'
}, {
slot: 'checkout',
title: 'Checkout',
description: 'Confirm your order'
}
]
const stepper = useTemplateRef('stepper')
</script>
<template>
<div class="w-full">
<UStepper ref="stepper" :items="items">
<template #content="{ item }">
<Placeholder class="aspect-video">
{{ item.title }}
</Placeholder>
</template>
</UStepper>
<div class="flex gap-2 justify-between mt-4">
<UButton
leading-icon="i-lucide-arrow-left"
:disabled="!stepper?.hasPrev"
@click="stepper?.prev()"
>
Prev
</UButton>
<UButton
trailing-icon="i-lucide-arrow-right"
:disabled="!stepper?.hasNext"
@click="stepper?.next()"
>
Next
</UButton>
</div>
</div>
</template>

View File

@@ -143,14 +143,13 @@ const data = ref<Payment[]>([{
const columns: TableColumn<Payment>[] = [{
id: 'select',
header: ({ table }) => h(UCheckbox, {
'modelValue': table.getIsAllPageRowsSelected(),
'indeterminate': table.getIsSomePageRowsSelected(),
'onUpdate:modelValue': (value: boolean) => table.toggleAllPageRowsSelected(!!value),
'modelValue': table.getIsSomePageRowsSelected() ? 'indeterminate' : table.getIsAllPageRowsSelected(),
'onUpdate:modelValue': (value: boolean | 'indeterminate') => table.toggleAllPageRowsSelected(!!value),
'ariaLabel': 'Select all'
}),
cell: ({ row }) => h(UCheckbox, {
'modelValue': row.getIsSelected(),
'onUpdate:modelValue': (value: boolean) => row.toggleSelected(!!value),
'onUpdate:modelValue': (value: boolean | 'indeterminate') => row.toggleSelected(!!value),
'ariaLabel': 'Select row'
}),
enableSorting: false,

View File

@@ -48,14 +48,13 @@ const data = ref<Payment[]>([{
const columns: TableColumn<Payment>[] = [{
id: 'select',
header: ({ table }) => h(UCheckbox, {
'modelValue': table.getIsAllPageRowsSelected(),
'indeterminate': table.getIsSomePageRowsSelected(),
'onUpdate:modelValue': (value: boolean) => table.toggleAllPageRowsSelected(!!value),
'modelValue': table.getIsSomePageRowsSelected() ? 'indeterminate' : table.getIsAllPageRowsSelected(),
'onUpdate:modelValue': (value: boolean | 'indeterminate') => table.toggleAllPageRowsSelected(!!value),
'ariaLabel': 'Select all'
}),
cell: ({ row }) => h(UCheckbox, {
'modelValue': row.getIsSelected(),
'onUpdate:modelValue': (value: boolean) => row.toggleSelected(!!value),
'onUpdate:modelValue': (value: boolean | 'indeterminate') => row.toggleSelected(!!value),
'ariaLabel': 'Select row'
})
}, {

View File

@@ -10,7 +10,7 @@ function showToast() {
title: 'Uh oh! Something went wrong.',
description: props.description,
actions: [{
icon: 'i-lucide-refresh-ccw',
icon: 'i-lucide-refresh-cw',
label: 'Retry',
color: 'neutral',
variant: 'outline',

View File

@@ -7,9 +7,9 @@ const appConfig = useAppConfig()
<UFormField
label="toaster.duration"
size="sm"
class="inline-flex ring ring-[var(--ui-border-accented)] rounded"
class="inline-flex ring ring-[var(--ui-border-accented)] rounded-[var(--ui-radius)]"
:ui="{
wrapper: 'bg-[var(--ui-bg-elevated)]/50 rounded-l flex border-r border-[var(--ui-border-accented)]',
wrapper: 'bg-[var(--ui-bg-elevated)]/50 rounded-l-[var(--ui-radius)] flex border-r border-[var(--ui-border-accented)]',
label: 'text-[var(--ui-text-muted)] px-2 py-1.5',
container: 'mt-0'
}"
@@ -18,8 +18,7 @@ const appConfig = useAppConfig()
v-model="appConfig.toaster.duration"
color="neutral"
variant="soft"
class="rounded rounded-l-none min-w-12"
:search-input="false"
:ui="{ base: 'rounded-[var(--ui-radius)] rounded-l-none min-w-12' }"
/>
</UFormField>
</div>

View File

@@ -7,9 +7,9 @@ const appConfig = useAppConfig()
<UFormField
label="toaster.expand"
size="sm"
class="inline-flex ring ring-[var(--ui-border-accented)] rounded"
class="inline-flex ring ring-[var(--ui-border-accented)] rounded-[var(--ui-radius)]"
:ui="{
wrapper: 'bg-[var(--ui-bg-elevated)]/50 rounded-l flex border-r border-[var(--ui-border-accented)]',
wrapper: 'bg-[var(--ui-bg-elevated)]/50 rounded-l-[var(--ui-radius)] flex border-r border-[var(--ui-border-accented)]',
label: 'text-[var(--ui-text-muted)] px-2 py-1.5',
container: 'mt-0'
}"
@@ -19,7 +19,7 @@ const appConfig = useAppConfig()
:items="[true, false]"
color="neutral"
variant="soft"
class="rounded rounded-l-none min-w-12"
class="rounded-[var(--ui-radius)] rounded-l-none min-w-12"
:search-input="false"
/>
</UFormField>

View File

@@ -10,9 +10,9 @@ const appConfig = useAppConfig()
<UFormField
label="toaster.position"
size="sm"
class="inline-flex ring ring-[var(--ui-border-accented)] rounded"
class="inline-flex ring ring-[var(--ui-border-accented)] rounded-[var(--ui-radius)]"
:ui="{
wrapper: 'bg-[var(--ui-bg-elevated)]/50 rounded-l flex border-r border-[var(--ui-border-accented)]',
wrapper: 'bg-[var(--ui-bg-elevated)]/50 rounded-l-[var(--ui-radius)] flex border-r border-[var(--ui-border-accented)]',
label: 'text-[var(--ui-text-muted)] px-2 py-1.5',
container: 'mt-0'
}"
@@ -22,7 +22,7 @@ const appConfig = useAppConfig()
:items="positions"
color="neutral"
variant="soft"
class="rounded rounded-l-none min-w-12"
class="rounded-[var(--ui-radius)] rounded-l-none min-w-12"
:search-input="false"
/>
</UFormField>

View File

@@ -56,7 +56,7 @@ defineProps({
<h1 class="m-0 text-[75px] font-semibold mb-2 text-white flex items-center">
<span>{{ title }}</span>
</h1>
<p v-if="description" class="text-[32px] text-[#94a3b8] leading-tight">
<p v-if="description" class="text-[32px] text-[#94a3b8] leading-tight text-balance">
{{ description.slice(0, 200) }}
</p>
</div>

View File

@@ -0,0 +1,40 @@
import type { ContentNavigationItem } from '@nuxt/content'
function processNavigationItem(item: ContentNavigationItem, parent?: ContentNavigationItem): any {
if (item.shadow) {
return item.children?.flatMap(child => processNavigationItem(child, item))
}
return {
...item,
title: parent?.title && parent.title !== 'Pro' ? parent.title : item.title,
badge: parent?.badge || item.badge,
class: [item.framework && `${item.framework}-only`, item.module && `${item.module}-only`].filter(Boolean),
children: item.children?.length ? item.children?.flatMap(child => processNavigationItem(child)) : undefined
}
}
export const useContentNavigation = (navigation: Ref<ContentNavigationItem[] | undefined>) => {
const { framework, module } = useSharedData()
const mappedNavigation = computed(() => navigation.value?.map(item => processNavigationItem(item)))
const filteredNavigation = computed(() => mappedNavigation.value?.map((item) => {
return {
...item,
children: item.children?.filter((child: any) => {
if (child.framework && child.framework !== framework.value) {
return false
}
if (child.module && child.module !== module.value) {
return false
}
return true
})
}
}))
return {
mappedNavigation,
filteredNavigation
}
}

View File

@@ -0,0 +1,36 @@
export function useSharedData() {
const framework = useCookie('nuxt-ui-framework', { default: () => 'nuxt' })
const frameworks = computed(() => [{
label: 'Nuxt',
icon: 'i-simple-icons-nuxtdotjs',
value: 'nuxt',
onSelect: () => framework.value = 'nuxt'
}, {
label: 'Vue',
icon: 'i-simple-icons-vuedotjs',
value: 'vue',
disabled: module.value === 'ui-pro',
onSelect: () => framework.value = 'vue'
}].map(f => ({ ...f, active: framework.value === f.value })))
const module = useCookie('nuxt-ui-module', { default: () => 'ui' })
const modules = computed(() => [{
label: 'nuxt/ui',
icon: 'i-lucide-box',
value: 'ui',
onSelect: () => module.value = 'ui'
}, {
label: 'nuxt/ui-pro',
icon: 'i-lucide-boxes',
value: 'ui-pro',
disabled: framework.value === 'vue',
onSelect: () => module.value = 'ui-pro'
}].map(m => ({ ...m, active: module.value === m.value })))
return {
framework,
frameworks,
module,
modules
}
}

View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import colors from 'tailwindcss/colors'
// import { debounce } from 'perfect-debounce'
import type { NuxtError } from '#app'
const props = defineProps<{
@@ -10,37 +11,47 @@ const route = useRoute()
const appConfig = useAppConfig()
const colorMode = useColorMode()
const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('content'))
const { data: files } = await useAsyncData('files', () => queryCollectionSearchSections('content', { ignoredTags: ['style'] }))
const links = computed(() => {
return [{
label: 'Docs',
icon: 'i-lucide-book-open',
to: '/getting-started',
active: route.path.startsWith('/getting-started') || route.path.startsWith('/components')
}, ...(navigation.value?.find(item => item.path === '/pro')
? [{
label: 'Pro',
icon: 'i-lucide-layers-3',
to: '/pro',
active: route.path.startsWith('/pro/getting-started') || route.path.startsWith('/pro/components') || route.path.startsWith('/pro/prose')
}, {
label: 'Pricing',
icon: 'i-lucide-credit-card',
to: '/pro/pricing'
}, {
label: 'Templates',
icon: 'i-lucide-monitor',
to: '/pro/templates'
}]
: []), {
label: 'Releases',
icon: 'i-lucide-rocket',
to: '/releases'
}].filter(Boolean)
const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('content', ['framework', 'module']))
const { data: files } = useLazyAsyncData('search', () => queryCollectionSearchSections('content'), {
server: false
})
const searchTerm = ref('')
// watch(searchTerm, debounce((query: string) => {
// if (!query) {
// return
// }
// useTrackEvent('Search', { props: { query: `${query} - ${searchTerm.value?.commandPaletteRef.results.length} results` } })
// }, 500))
const links = computed(() => [{
label: 'Docs',
icon: 'i-lucide-square-play',
to: '/getting-started',
active: route.path.startsWith('/getting-started')
}, {
label: 'Components',
icon: 'i-lucide-square-code',
to: '/components',
active: route.path.startsWith('/components')
}, {
label: 'Roadmap',
icon: 'i-lucide-map',
to: '/roadmap'
}, {
label: 'Figma',
icon: 'i-lucide-figma',
to: 'https://www.figma.com/community/file/1288455405058138934',
target: '_blank'
}, {
label: 'Releases',
icon: 'i-lucide-rocket',
to: 'https://github.com/nuxt/ui/releases',
target: '_blank'
}].filter(Boolean))
const color = computed(() => colorMode.value === 'dark' ? (colors as any)[appConfig.ui.colors.neutral][900] : 'white')
const radius = computed(() => `:root { --ui-radius: ${appConfig.theme.radius}rem; }`)
@@ -70,23 +81,40 @@ useServerSeoMeta({
twitterCard: 'summary_large_image'
})
provide('navigation', navigation)
const { frameworks, modules } = useSharedData()
const { mappedNavigation, filteredNavigation } = useContentNavigation(navigation)
provide('navigation', mappedNavigation)
</script>
<template>
<UApp>
<NuxtLoadingIndicator color="#FFF" />
<Banner />
<!-- <Banner /> -->
<Header :links="links" />
<UError :error="error" />
<Footer />
<!-- <Footer /> -->
<ClientOnly>
<LazyUContentSearch :files="files" :navigation="navigation" :fuse="{ resultLimit: 42 }" />
<LazyUContentSearch
v-model:search-term="searchTerm"
:files="files"
:groups="[{
id: 'framework',
label: 'Framework',
items: frameworks
}, {
id: 'module',
label: 'Module',
items: modules
}]"
:navigation="filteredNavigation"
:fuse="{ resultLimit: 42 }"
/>
</ClientOnly>
</UApp>
</template>

View File

@@ -10,6 +10,13 @@ const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
<UPage>
<template #left>
<UPageAside>
<template #top>
<div class="flex flex-col gap-2 w-[calc(100%+1.25rem)] -mx-2.5">
<ModuleSelect />
<FrameworkSelect />
</div>
</template>
<UContentNavigation :navigation="navigation" highlight />
</UPageAside>
</template>

View File

@@ -3,6 +3,7 @@ import type { ContentNavigationItem } from '@nuxt/content'
import { findPageBreadcrumb, mapContentNavigation } from '#ui-pro/utils/content'
const route = useRoute()
const { framework, module } = useSharedData()
definePageMeta({
layout: 'docs'
@@ -13,20 +14,61 @@ if (!page.value) {
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
}
const { data: surround } = await useAsyncData(`${route.path}-surround`, () => queryCollectionItemSurroundings('content', route.path, {
fields: ['description']
}))
const { data: surround } = await useAsyncData(`${route.path}-surround`, () => {
return queryCollectionItemSurroundings('content', route.path, {
fields: ['description']
}).orWhere(group => group.where('framework', '=', framework.value).where('framework', 'IS NULL'))
.orWhere(group => group.where('module', '=', module.value).where('module', 'IS NULL'))
}, {
watch: [framework, module]
})
const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
const breadcrumb = computed(() => mapContentNavigation(findPageBreadcrumb(navigation?.value, page.value)))
const breadcrumb = computed(() => mapContentNavigation(findPageBreadcrumb(navigation?.value, page.value)).map(({ icon, ...link }) => link))
if (!import.meta.prerender) {
// Redirect to the correct framework version if the page is not the current framework
watch(framework, () => {
if (page.value?.framework && page.value?.framework !== framework.value) {
if (route.path.endsWith(`/${page.value?.framework}`)) {
navigateTo(`${route.path.split('/').slice(0, -1).join('/')}/${framework.value}`)
} else {
navigateTo(`/getting-started`)
}
}
})
// Redirect to the correct module version if the page is not the current module
watch(module, () => {
if (page.value?.module && page.value?.module !== module.value) {
if (page.value?.module === 'ui-pro' && route.path.includes('/pro')) {
navigateTo(`${route.path.replace('/pro', '')}`)
} else if (page.value?.module === 'ui' && !route.path.includes('/pro')) {
navigateTo(`${route.path.replace(`/${framework.value}`, '')}/pro/${framework.value}`)
} else {
navigateTo(`/getting-started`)
}
}
})
}
// Update the framework/module if the page has different ones
watch(page, () => {
if (page.value?.framework && page.value?.framework !== framework.value) {
framework.value = page.value?.framework as string
}
if (page.value?.module && page.value?.module !== module.value) {
module.value = page.value?.module as string
}
}, { immediate: true })
useSeoMeta({
titleTemplate: '%s - Nuxt UI v3',
title: typeof page.value.navigation === 'object' ? page.value.navigation.title : page.value.title,
ogTitle: `${typeof page.value.navigation === 'object' ? page.value.navigation.title : page.value.title} - Nuxt UI v3`,
description: page.value.seo?.description || page.value.description,
ogDescription: page.value.seo?.description || page.value.description
titleTemplate: `%s - Nuxt UI ${page.value.module === 'ui-pro' ? 'Pro' : ''} v3${page.value.framework === 'vue' ? ' for Vue' : ''}`,
title: page.value.navigation?.title ? page.value.navigation.title : page.value.title,
ogTitle: `${page.value.navigation?.title ? page.value.navigation.title : page.value.title} - Nuxt UI ${page.value.module === 'ui-pro' ? 'Pro' : ''} v3${page.value.framework === 'vue' ? ' for Vue' : ''}`,
description: page.value.description,
ogDescription: page.value.description
})
defineOgImageComponent('Docs', {
@@ -34,7 +76,7 @@ defineOgImageComponent('Docs', {
})
const communityLinks = computed(() => [{
icon: 'i-lucide-square-pen',
icon: 'i-lucide-file-pen',
label: 'Edit this page',
to: `https://github.com/nuxt/ui/edit/v3/docs/content/${page?.value?.stem}.md`,
target: '_blank'
@@ -43,10 +85,6 @@ const communityLinks = computed(() => [{
label: 'Star on GitHub',
to: 'https://github.com/nuxt/ui',
target: '_blank'
}, {
label: 'Roadmap',
icon: 'i-lucide-map',
to: '/roadmap'
}])
// const resourcesLinks = [{
@@ -78,27 +116,13 @@ const communityLinks = computed(() => [{
<MDC v-if="page.description" :value="page.description" unwrap="p" />
</template>
<template #links>
<UDropdownMenu v-if="page.select" v-slot="{ open }" :items="page.select.items" :content="{ align: 'end' }">
<UButton
color="neutral"
variant="subtle"
v-bind="page.select.items.find((item: any) => item.to === route.path)"
block
trailing-icon="i-lucide-chevron-down"
:class="[open && 'bg-[var(--ui-bg-accented)]/75']"
:ui="{
trailingIcon: ['transition-transform duration-200', open ? 'rotate-180' : undefined].filter(Boolean).join(' ')
}"
class="w-[128px]"
/>
</UDropdownMenu>
<template v-if="page.links?.length" #links>
<UButton
v-for="link in page.links"
:key="link.label"
color="neutral"
variant="outline"
target="_blank"
v-bind="link"
>
<template v-if="link.avatar" #leading>

View File

@@ -20,7 +20,7 @@ const src = computed(() => `https://volta.net/embed/${token}?theme=${colorMode.v
</script>
<template>
<div class="h-[calc(100vh-var(--ui-header-height)-var(--ui-header-height)-48px-1px)]">
<div class="h-[calc(100vh-var(--ui-header-height))]">
<ClientOnly>
<iframe :src="src" width="100%" height="100%" />
</ClientOnly>

38
docs/app/plugins/data.ts Normal file
View File

@@ -0,0 +1,38 @@
export default defineNuxtPlugin({
enforce: 'post',
setup() {
const { framework, module } = useSharedData()
if (import.meta.client) {
useHead({
htmlAttrs: {
'data-framework': framework,
'data-module': module
}
})
}
if (import.meta.server) {
useHead({
script: [{
innerHTML: `
function getCookie(name) {
var value = '; ' + window.document.cookie;
var parts = value.split('; ' + name + '=');
if (parts.length === 2) {
return parts.pop()?.split(';').shift();
}
}
var f = getCookie('nuxt-ui-framework');
document.documentElement.setAttribute('data-framework', f || 'nuxt');
var m = getCookie('nuxt-ui-module');
document.documentElement.setAttribute('data-module', m || 'ui');
`.replace(/\s+/g, ' '),
type: 'text/javascript',
tagPriority: -1
}]
})
}
}
})

View File

@@ -1,27 +1,45 @@
import { defineCollection, z } from '@nuxt/content'
import { resolve } from 'node:path'
const schema = z.object({
framework: z.string().optional(),
module: z.string().optional(),
navigation: z.object({
title: z.string().optional()
}),
links: z.array(z.object({
label: z.string(),
icon: z.string(),
avatar: z.object({
src: z.string(),
alt: z.string()
}).optional(),
to: z.string(),
target: z.string().optional()
}))
})
const pro = process.env.NUXT_UI_PRO_PATH
? {
cwd: resolve(__dirname, process.env.NUXT_UI_PRO_PATH, 'docs'),
include: 'content/**',
prefix: '/'
}
: process.env.NUXT_GITHUB_TOKEN
? {
repository: 'https://github.com/nuxt/ui-pro/tree/v3',
include: 'docs/content/**',
prefix: '/',
authToken: process.env.NUXT_GITHUB_TOKEN
}
: undefined
export const collections = {
content: defineCollection({
type: 'page',
source: '**/*',
schema: z.object({
links: z.array(z.object({
label: z.string(),
icon: z.string(),
avatar: z.object({
src: z.string(),
alt: z.string()
}).optional(),
to: z.string(),
target: z.string().optional()
})),
select: z.object({
items: z.array(z.object({
label: z.string(),
icon: z.string(),
to: z.string()
}))
})
})
source: [{
include: '**/*'
}, pro!].filter(Boolean),
schema
})
}

View File

@@ -1 +1,2 @@
title: Getting Started
icon: i-lucide-square-play

View File

@@ -8,12 +8,12 @@ We're thrilled to introduce this major update to our UI library, bringing signif
## What's New in v3?
### Radix Vue
### Reka UI (Radix Vue)
We've transitioned from [Headless UI](https://headlessui.com/) to [Radix Vue](https://www.radix-vue.com/) as our core component foundation. This shift brings several key advantages:
We've transitioned from [Headless UI](https://headlessui.com/) to [Reka UI](https://reka-ui.com/) as our core component foundation. This shift brings several key advantages:
- **Extensive Component Library**: With 55+ primitives, Radix Vue significantly expands our component offerings.
- **Active Development**: Radix Vue's growing popularity ensures ongoing improvements and updates.
- **Extensive Component Library**: With 55+ primitives, Reka UI significantly expands our component offerings.
- **Active Development**: Reka UI's growing popularity ensures ongoing improvements and updates.
- **Enhanced Accessibility**: Built-in accessibility features align with our commitment to inclusive design.
- **Vue 3 Optimization**: Seamless integration with Vue 3 and the Composition API.
@@ -21,15 +21,15 @@ This transition empowers Nuxt UI to become a more comprehensive and flexible UI
### Tailwind CSS v4
Nuxt UI v3 integrates the latest Tailwind CSS v4 alpha (announced March 6, 2024), bringing significant improvements:
Nuxt UI v3 integrates the latest Tailwind CSS v4 beta (released Nov 21, 2024), bringing significant improvements:
- **Faster Builds**: Up to 10x faster, especially for larger projects.
- **Unified Toolchain**: Built-in features like vendor prefixing, nesting support, and modern CSS transforms.
- **CSS-First Configuration**: New `@theme` directive for easy customization without JavaScript.
- **Optimized Performance**: Smaller engine footprint and more efficient processing.
- **Built for performance**: Full builds in the new engine are up to 5x faster, and incremental builds are over 100x faster — and measured in microseconds.
- **Unified toolchain**: Built-in import handling, vendor prefixing, and syntax transforms, with no additional tooling required.
- **CSS-first configuration**: A reimagined developer experience where you customize and extend the framework directly in CSS instead of a JavaScript configuration file.
- **Designed for the modern web**: Built on native cascade layers, wide-gamut colors, and including first-class support for modern CSS features like container queries, @starting-style, popovers, and more.
::note
For a comprehensive overview of Tailwind CSS v4 alpha features, visit the [official announcement](https://tailwindcss.com/blog/tailwindcss-v4-alpha).
::note{to="https://tailwindcss.com/docs/v4-beta" target="_blank"}
For a comprehensive overview of Tailwind CSS v4 beta features, read the **prerelease documentation**.
::
### Tailwind Variants
@@ -71,7 +71,7 @@ You can now use Nuxt UI in any Vue project without Nuxt by adding the Vite and V
- **Developer Experience**: Complete TypeScript support with IntelliSense and auto-completion
::tip{to="/getting-started/installation/vue"}
Learn how to install and configure Nuxt UI in a Vue project in the [Vue installation guide](/getting-started/installation/vue).
Learn how to install and configure Nuxt UI in a Vue project in the **Vue installation guide**.
::
## Migration
@@ -90,6 +90,10 @@ Key points to consider:
The transition to v3 involves significant changes, including new component structures, updated theming approaches, and revised TypeScript definitions. We recommend a careful, incremental upgrade process, starting with thorough testing in a development environment.
::
::accordion-item{label="Is Nuxt UI v3 compatible with standalone Vue projects?"}
Nuxt UI is now compatible with Vue! You can follow the [installation guide](/getting-started/installation/vue) to get started.
::
::accordion-item{label="What about Nuxt UI Pro?"}
We've also rebuilt Nuxt UI Pro from scratch and released a `v3.0.0-alpha.x` package but it only contains the components to build this documentation yet. This will be a free update, so the license you buy now will be valid for v3. We're actively working to finish the rewrite of all Nuxt UI Pro components.
::
@@ -98,16 +102,12 @@ Key points to consider:
Nuxt UI v3 is currently designed to work exclusively with Tailwind CSS. While there's interest in UnoCSS support, implementing it would require significant changes to the theme structure due to differences in class naming conventions. As a result, we don't have plans to add UnoCSS support in v3.
::
::accordion-item{label="Is Nuxt UI v3 compatible with standalone Vue projects?"}
We're planning to add Vue support in the near future. For now, Nuxt UI v3 is only available for Nuxt. Track progress on Vue compatibility [in this issue](https://github.com/nuxt/ui/issues/2129).
::
::accordion-item{label="How does Nuxt UI v3 handle accessibility?"}
Nuxt UI v3 enhances accessibility through Radix Vue integration. This provides automatic ARIA attributes, keyboard navigation support, intelligent focus management, and screen reader announcements. While offering a strong foundation, proper implementation and testing in your specific use case remains crucial for full accessibility compliance. For more detailed information, refer to [Radix Vue's accessibility documentation](https://www.radix-vue.com/overview/accessibility.html).
Nuxt UI v3 enhances accessibility through Reka UI integration. This provides automatic ARIA attributes, keyboard navigation support, intelligent focus management, and screen reader announcements. While offering a strong foundation, proper implementation and testing in your specific use case remains crucial for full accessibility compliance. For more detailed information, refer to [Reka UI's accessibility documentation](https://reka-ui.com/docs/overview/accessibility).
::
::accordion-item{label="What is the testing approach for Nuxt UI v3?"}
Nuxt UI v3 ensures reliability with 800+ Vitest tests, covering core functionality and accessibility. This robust testing suite supports the library's stability and serves as a reference for developers.
Nuxt UI v3 ensures reliability with 1000+ Vitest tests, covering core functionality and accessibility. This robust testing suite supports the library's stability and serves as a reference for developers.
::
::accordion-item{label="Is this version stable and suitable for production use?"}

View File

@@ -0,0 +1 @@
shadow: true

View File

@@ -1,20 +1,21 @@
---
title: Install in a Nuxt app
navigation.title: Nuxt
title: Installation
description: 'Learn how to install and configure Nuxt UI in your Nuxt application.'
select:
items:
- label: Nuxt
icon: i-logos-nuxt-icon
to: /getting-started/installation/nuxt
- label: Vue
icon: i-logos-vue
to: /getting-started/installation/vue
framework: nuxt
module: ui
---
::callout{to="/getting-started/installation/vue" icon="i-logos-vue" class="hidden"}
Looking for the **Vue** version?
::
## Setup
1. Install the Nuxt UI v3 alpha package:
### Add to a Nuxt project
::steps{level="4"}
#### Install the Nuxt UI v3 alpha package
::code-group{sync="pm"}
@@ -37,10 +38,10 @@ bun add @nuxt/ui@next
::
::warning
If you're using **pnpm**, ensure that you either set [`shamefully-hoist=true`](https://pnpm.io/npmrc#shamefully-hoist) in your `.npmrc` file or install `tailwindcss@next` directly in your project's root directory.
If you're using **pnpm**, ensure that you either set [`shamefully-hoist=true`](https://pnpm.io/npmrc#shamefully-hoist) in your `.npmrc` file or install `tailwindcss@next` in your project's root directory.
::
2. Register the Nuxt UI module in your `nuxt.config.ts`{lang="ts-type"}:
#### Add the Nuxt UI module in your `nuxt.config.ts`{lang="ts-type"}
```ts [nuxt.config.ts]
export default defineNuxtConfig({
@@ -48,18 +49,28 @@ export default defineNuxtConfig({
})
```
3. Import Tailwind CSS and Nuxt UI in your `app.vue`{lang="ts-type"} or [CSS](https://nuxt.com/docs/getting-started/styling#the-css-property):
#### Import Tailwind CSS and Nuxt UI in your CSS
```vue [app.vue]
<style>
```css [assets/css/main.css]
@import "tailwindcss";
@import "@nuxt/ui";
</style>
```
::tip
Use the `css` property in your `nuxt.config.ts` to import your CSS file.
```ts [nuxt.config.ts]
export default defineNuxtConfig({
modules: ['@nuxt/ui'],
css: ['~/assets/css/main.css']
})
```
::
::callout{icon="i-simple-icons-visualstudiocode"}
It's recommended to install the [Tailwind CSS IntelliSense](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss) extension for VSCode and add the following settings:
```json
```json [settings.json]
"files.associations": {
"*.css": "tailwindcss"
},
@@ -70,10 +81,43 @@ It's recommended to install the [Tailwind CSS IntelliSense](https://marketplace.
::
::warning
IntelliSense works better when importing `tailwindcss` in a proper `.css` file which will be automatically detected.
#### Wrap your app with App component
```vue [app.vue]
<template>
<UApp>
<NuxtPage />
</UApp>
</template>
```
::note{to="/components/app"}
The `App` component provides global configurations and is required for **Toast** and **Tooltip** components to work.
::
::
### Use our Nuxt Starter
Start your project with a Nuxt template with Nuxt UI v3 pre-configured by using our [Nuxt UI Starter](https://github.com/nuxt/starter/tree/ui3).
Create a new project locally by running the following command:
```bash [Terminal]
npx nuxi@latest init -t ui3 <my-app>
```
::note
The `<my-app>` argument is the name of the directory where the project will be created, replace it with your project name.
::
Once the installation is complete, navigate into your project and start the development server:
```bash [Terminal]
cd <my-app>
npm run dev
```
## Options
You can customize Nuxt UI by providing options in your `nuxt.config.ts`.

View File

@@ -1,20 +1,19 @@
---
navigation.title: Vue
title: Install in a Vue app
title: Installation
description: 'Learn how to install and configure Nuxt UI in your Vue application.'
select:
items:
- label: Nuxt
icon: i-logos-nuxt-icon
to: /getting-started/installation/nuxt
- label: Vue
icon: i-logos-vue
to: /getting-started/installation/vue
framework: vue
module: ui
---
::callout{to="/getting-started/installation/nuxt" icon="i-logos-nuxt-icon" class="hidden"}
Looking for the **Nuxt** version?
::
## Setup
1. Install the Nuxt UI v3 alpha package:
::steps{level="4"}
#### Install the Nuxt UI v3 alpha package
::code-group{sync="pm"}
@@ -37,12 +36,12 @@ bun add @nuxt/ui@next
::
::warning
If you're using **pnpm**, ensure that you either set [`shamefully-hoist=true`](https://pnpm.io/npmrc#shamefully-hoist) in your `.npmrc` file or install `tailwindcss@next`, `vue-router` and `@unhead/vue` directly in your project's root directory.
If you're using **pnpm**, ensure that you either set [`shamefully-hoist=true`](https://pnpm.io/npmrc#shamefully-hoist) in your `.npmrc` file or install `tailwindcss@next`, `vue-router` and `@unhead/vue` in your project's root directory.
::
2. Add the Nuxt UI Vite plugin in your `vite.config.ts`{lang="ts-type"}:
#### Add the Nuxt UI Vite plugin in your `vite.config.ts`{lang="ts-type"}
```ts [vite.config.ts]
```ts [vite.config.ts]{3,8}
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'
@@ -51,7 +50,7 @@ export default defineConfig({
plugins: [
vue(),
ui()
],
]
})
```
@@ -71,31 +70,49 @@ components.d.ts
```
::
3. Register the Nuxt UI Vue plugin in your app:
#### Use the Nuxt UI Vue plugin in your `main.ts`
```ts [main.ts]
```ts [main.ts]{2,7}
import { createApp } from 'vue'
import nuxtUI from '@nuxt/ui/vue-plugin'
import ui from '@nuxt/ui/vue-plugin'
import App from './App.vue'
const app = createApp(App)
// ...
app.use(nuxtUI)
app.use(ui)
app.mount('#app')
```
4. Import Tailwind CSS and Nuxt UI in your `App.vue`{lang="ts-type"} or CSS:
#### Import Tailwind CSS and Nuxt UI in your CSS
```vue [App.vue]
<style>
```css [assets/main.css]
@import "tailwindcss";
@import "@nuxt/ui";
</style>
```
::tip
Import the CSS file in your `main.ts`.
```ts [main.ts]{1}
import './assets/main.css'
import { createApp } from 'vue'
import ui from '@nuxt/ui/vue-plugin'
import App from './App.vue'
const app = createApp(App)
app.use(ui)
app.mount('#app')
```
::
::callout{icon="i-simple-icons-visualstudiocode"}
It's recommended to install the [Tailwind CSS IntelliSense](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss) extension for VSCode and add the following settings:
```json
```json [settings.json]
"files.associations": {
"*.css": "tailwindcss"
},
@@ -106,8 +123,20 @@ It's recommended to install the [Tailwind CSS IntelliSense](https://marketplace.
::
::warning
IntelliSense works better when importing `tailwindcss` in a proper `.css` file which will be automatically detected.
#### Wrap your app with App component
```vue [App.vue]
<template>
<UApp>
<RouterView />
</UApp>
</template>
```
::note{to="/components/app"}
The `App` component provides global configurations and is required for **Toast** and **Tooltip** components to work.
::
::
## Options
@@ -139,10 +168,6 @@ export default defineConfig({
Use the `ui` option to provide configuration for Nuxt UI.
::warning
In the rest of the docs, there are references to the `app.config.ts` file (which is a Nuxt feature). When using Nuxt UI in a project without Nuxt, this configuration is passed in this `ui` option instead.
::
```ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

View File

@@ -5,19 +5,21 @@ description: 'Learn how to customize Nuxt UI components using Tailwind CSS v4, C
## Tailwind CSS
Nuxt UI v3 uses Tailwind CSS v4 alpha which doesn't have a documentation yet, let's have a look on how to use it.
Nuxt UI v3 uses Tailwind CSS v4 beta, you can read the [prerelease documentation](https://tailwindcss.com/docs/v4-beta) for more information.
### `@theme`
Tailwind CSS v4 takes a CSS-first configuration approach, you now customize your theme with CSS variables inside a `@theme` directive:
```vue [app.vue]
<style>
::module-only
#ui
:::div
```css [main.css]
@import "tailwindcss";
@import "@nuxt/ui";
@theme {
--font-family-sans: 'Public Sans', sans-serif;
--font-sans: 'Public Sans', sans-serif;
--breakpoint-3xl: 1920px;
@@ -33,13 +35,40 @@ Tailwind CSS v4 takes a CSS-first configuration approach, you now customize your
--color-green-900: #0A5331;
--color-green-950: #052E16;
}
</style>
```
:::
#ui-pro
:::div
```css [main.css]
@import "tailwindcss";
@import "@nuxt/ui-pro";
@theme {
--font-sans: 'Public Sans', sans-serif;
--breakpoint-3xl: 1920px;
--color-green-50: #EFFDF5;
--color-green-100: #D9FBE8;
--color-green-200: #B3F5D1;
--color-green-300: #75EDAE;
--color-green-400: #00DC82;
--color-green-500: #00C16A;
--color-green-600: #00A155;
--color-green-700: #007F45;
--color-green-800: #016538;
--color-green-900: #0A5331;
--color-green-950: #052E16;
}
```
:::
::
The `@theme` directive tells Tailwind to make new utilities and variants available based on these variables. It's the equivalent of the `theme.extend` key in Tailwind CSS v3 `tailwind.config.ts` file.
::note
You can learn more about this on [https://tailwindcss.com/blog/tailwindcss-v4-alpha](https://tailwindcss.com/blog/tailwindcss-v4-alpha#css-first-configuration).
::note{to="https://tailwindcss.com/docs/v4-beta#css-first-configuration" target="_blank"}
Learn more about Tailwind CSS v4 CSS-first configuration approach.
::
### `@source`
@@ -48,34 +77,60 @@ You can use the `@source` directive to add explicit content glob patterns if you
This can be useful when writing Tailwind classes in markdown files with [`@nuxt/content`](https://github.com/nuxt/content):
```vue [app.vue]
<style>
::module-only
#ui
:::div
```css [main.css]
@import "tailwindcss";
@import "@nuxt/ui";
@source "../content/**/*.md";
</style>
@source "../content";
```
:::
::note{to="https://github.com/tailwindlabs/tailwindcss/pull/14078"}
You can learn more about the `@source` directive in this pull request.
#ui-pro
:::div
```css [main.css]
@import "tailwindcss";
@import "@nuxt/ui-pro";
@source "../content";
```
:::
::
::note{to="https://tailwindcss.com/docs/v4-beta#adding-content-sources"}
Learn how to add content sources in Tailwind CSS v4.
::
### `@plugin`
You can use the `@plugin` directive to import Tailwind CSS plugins.
```vue [app.vue]
<style>
::module-only
#ui
:::div
```css [main.css]
@import "tailwindcss";
@import "@nuxt/ui";
@plugin "@tailwindcss/typography";
</style>
```
:::
::note{to="https://github.com/tailwindlabs/tailwindcss/pull/14264"}
You can learn more about the `@plugin` directive in this pull request.
#ui-pro
:::div
```css [main.css]
@import "tailwindcss";
@import "@nuxt/ui-pro";
@plugin "@tailwindcss/typography";
```
:::
::
::note{to="https://tailwindcss.com/docs/v4-beta#using-plugins"}
Learn more about using plugins in Tailwind CSS v4.
::
## Design system
@@ -84,8 +139,14 @@ Nuxt UI extends Tailwind CSS's theming capabilities, providing a flexible design
### Colors
::framework-only
#nuxt
Nuxt UI leverages Nuxt [App Config](https://nuxt.com/docs/guide/directory-structure/app-config#app-config-file) to provide customizable color aliases based on [Tailwind CSS colors](https://tailwindcss.com/docs/customizing-colors#color-palette-reference):
#vue
Nuxt UI leverages Vite config to provide customizable color aliases based on [Tailwind CSS colors](https://tailwindcss.com/docs/customizing-colors#color-palette-reference):
::
| Color | Default | Description |
| --- | --- | --- |
| `primary`{color="primary"} | `green` | Main brand color, used as the default color for components. |
@@ -96,6 +157,9 @@ Nuxt UI leverages Nuxt [App Config](https://nuxt.com/docs/guide/directory-struct
| `error`{color="error"} | `red` | Used for form error validation states. |
| `neutral` | `slate` | Neutral color for backgrounds, text, etc. |
::framework-only
#nuxt
::div
You can configure these color aliases at runtime in your `app.config.ts` file under the `ui.colors` key, allowing for dynamic theme customization without requiring an application rebuild:
```ts [app.config.ts]
@@ -108,6 +172,34 @@ export default defineAppConfig({
}
})
```
::
#vue
::div
You can configure these color aliases at runtime in your `vite.config.ts` file under the `ui.colors` key:
```ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'
export default defineConfig({
plugins: [
vue(),
ui({
ui: {
colors: {
primary: 'blue',
neutral: 'zinc'
}
}
})
]
})
```
::
::
::note
Try the :prose-icon{name="i-lucide-swatch-book" class="text-[var(--ui-primary)]"} theme picker in the header above to change `primary` and `neutral` colors.
@@ -124,8 +216,10 @@ slots:
---
::
::tip
You can add you own dynamic color aliases in your `app.config.ts`, you just have to make sure to define them in the [`ui.theme.colors`](/getting-started/installation#themecolors) option in your `nuxt.config.ts` file.
::framework-only
#nuxt
:::tip
You can add you own dynamic color aliases in your `app.config.ts`, you just have to make sure to define them in the [`ui.theme.colors`](/getting-started/installation/nuxt#themecolors) option in your `nuxt.config.ts` file.
```ts [app.config.ts]
export default defineAppConfig({
@@ -146,7 +240,34 @@ export default defineNuxtConfig({
}
})
```
:::
#vue
:::tip
You can add you own dynamic color aliases in your `vite.config.ts`, you just have to make sure to also define them in the [`theme.colors`](/getting-started/installation/vue#themecolors) option of the `ui` plugin.
```ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'
export default defineConfig({
plugins: [
vue(),
ui({
ui: {
colors: {
tertiary: 'indigo'
}
},
theme: {
colors: ['primary', 'secondary', 'tertiary', 'info', 'success', 'warning', 'error']
}
})
]
})
```
:::
::
::warning
@@ -154,8 +275,10 @@ These color aliases are not automatically defined as Tailwind CSS colors, so cla
However, you can generate these classes using Tailwind's `@theme` directive, allowing you to use custom color utility classes while maintaining dynamic color aliases:
```vue [app.vue]
<style>
::module-only
#ui
:::div
```css [main.css]
@import "tailwindcss";
@import "@nuxt/ui";
@@ -172,8 +295,32 @@ However, you can generate these classes using Tailwind's `@theme` directive, all
--color-primary-900: var(--ui-color-primary-900);
--color-primary-950: var(--ui-color-primary-950);
}
</style>
```
:::
#ui-pro
:::div
```css [main.css]
@import "tailwindcss";
@import "@nuxt/ui-pro";
@theme {
--color-primary-50: var(--ui-color-primary-50);
--color-primary-100: var(--ui-color-primary-100);
--color-primary-200: var(--ui-color-primary-200);
--color-primary-300: var(--ui-color-primary-300);
--color-primary-400: var(--ui-color-primary-400);
--color-primary-500: var(--ui-color-primary-500);
--color-primary-600: var(--ui-color-primary-600);
--color-primary-700: var(--ui-color-primary-700);
--color-primary-800: var(--ui-color-primary-800);
--color-primary-900: var(--ui-color-primary-900);
--color-primary-950: var(--ui-color-primary-950);
}
```
:::
::
::
### Tokens
@@ -217,8 +364,10 @@ You can use these variables in classes like `text-[var(--ui-primary)]`, it will
::tip
You can change which shade is used for each color on light and dark mode:
```vue [app.vue]
<style>
::module-only
#ui
:::div
```css [main.css]
@import "tailwindcss";
@import "@nuxt/ui";
@@ -229,8 +378,26 @@ You can change which shade is used for each color on light and dark mode:
.dark {
--ui-primary: var(--ui-color-primary-200);
}
</style>
```
:::
#ui-pro
:::div
```css [main.css]
@import "tailwindcss";
@import "@nuxt/ui-pro";
:root {
--ui-primary: var(--ui-color-primary-700);
}
.dark {
--ui-primary: var(--ui-color-primary-200);
}
```
:::
::
::
#### Neutral Palette
@@ -254,6 +421,8 @@ Nuxt UI provides a comprehensive set of design tokens for the `neutral` color pa
/* Main background color */
--ui-bg: var(--color-white);
/* Subtle background */
--ui-bg-muted: var(--ui-color-neutral-50);
/* Slightly elevated background */
--ui-bg-elevated: var(--ui-color-neutral-100);
/* More prominent background */
@@ -263,6 +432,8 @@ Nuxt UI provides a comprehensive set of design tokens for the `neutral` color pa
/* Default border color */
--ui-border: var(--ui-color-neutral-200);
/* Subtle border */
--ui-border-muted: var(--ui-color-neutral-200);
/* More prominent border */
--ui-border-accented: var(--ui-color-neutral-300);
/* Inverted border color */
@@ -285,6 +456,8 @@ Nuxt UI provides a comprehensive set of design tokens for the `neutral` color pa
/* Main background color */
--ui-bg: var(--ui-color-neutral-900);
/* Subtle background */
--ui-bg-muted: var(--ui-color-neutral-800);
/* Slightly elevated background */
--ui-bg-elevated: var(--ui-color-neutral-800);
/* More prominent background */
@@ -294,6 +467,8 @@ Nuxt UI provides a comprehensive set of design tokens for the `neutral` color pa
/* Default border color */
--ui-border: var(--ui-color-neutral-800);
/* Subtle border */
--ui-border-muted: var(--ui-color-neutral-700);
/* More prominent border */
--ui-border-accented: var(--ui-color-neutral-700);
/* Inverted border color */
@@ -316,8 +491,10 @@ body {
::tip
You can customize these CSS variables to tailor the appearance of your application:
```vue [app.vue]
<style>
::module-only
#ui
:::div
```css [main.css]
@import "tailwindcss";
@import "@nuxt/ui";
@@ -330,8 +507,28 @@ You can customize these CSS variables to tailor the appearance of your applicati
--ui-bg: var(--ui-color-neutral-950);
--ui-border: var(--ui-color-neutral-900);
}
</style>
```
:::
#ui-pro
:::div
```css [main.css]
@import "tailwindcss";
@import "@nuxt/ui-pro";
:root {
--ui-bg: var(--ui-color-neutral-50);
--ui-text: var(--ui-color-neutral-900);
}
.dark {
--ui-bg: var(--ui-color-neutral-950);
--ui-border: var(--ui-color-neutral-900);
}
```
:::
::
::
#### Border Radius
@@ -351,16 +548,81 @@ Try the :prose-icon{name="i-lucide-swatch-book" class="text-[var(--ui-primary)]"
::tip
You can customize the default radius value using the default Tailwind CSS variables or a value of your choice:
```vue [app.vue]
<style>
::module-only
#ui
:::div
```css [main.css]
@import "tailwindcss";
@import "@nuxt/ui";
:root {
--ui-radius: var(--radius-sm);
}
</style>
```
:::
#ui-pro
:::div
```css [main.css]
@import "tailwindcss";
@import "@nuxt/ui-pro";
:root {
--ui-radius: var(--radius-sm);
}
```
:::
::
::
#### Container
Nuxt UI uses a global `--ui-container` CSS variable to define the width of the container:
```css
:root {
--ui-container: var(--container-7xl);
}
```
::tip
You can customize the default container width using the default Tailwind CSS variables or a value of your choice:
::module-only
#ui
:::div
```css [main.css]
@import "tailwindcss";
@import "@nuxt/ui";
@theme {
--container-8xl: 90rem;
}
:root {
--ui-container: var(--container-8xl);
}
```
:::
#ui-pro
:::div
```css [main.css]
@import "tailwindcss";
@import "@nuxt/ui-pro";
@theme {
--container-8xl: 90rem;
}
:root {
--ui-container: var(--container-8xl);
}
```
:::
::
::
## Components theme
@@ -376,7 +638,7 @@ Components in Nuxt UI can have multiple `slots`, each representing a distinct HT
```ts [src/theme/card.ts]
export default {
slots: {
root: 'bg-[var(--ui-bg)] ring ring-[var(--ui-border)] divide-y divide-[var(--ui-border)] rounded-[calc(var(--ui-radius)*2)] shadow',
root: 'bg-[var(--ui-bg)] ring ring-[var(--ui-border)] divide-y divide-[var(--ui-border)] rounded-[calc(var(--ui-radius)*2)] shadow-sm',
header: 'p-4 sm:px-6',
body: 'p-4 sm:p-6',
footer: 'p-4 sm:px-6'
@@ -410,7 +672,7 @@ Some components don't have slots, they are just composed of a single root elemen
```ts [src/theme/container.ts]
export default {
base: 'max-w-7xl mx-auto px-4 sm:px-6 lg:px-8'
base: 'max-w-[var(--ui-container)] mx-auto px-4 sm:px-6 lg:px-8'
}
```
@@ -469,26 +731,41 @@ props:
---
::
The `defaultVariants` property specifies the default values for each variant. It determines how a component looks and behaves when no prop is provided. These default values can be customized in your [`app.config.ts`](#appconfigts) to adjust the standard appearance of components throughout your application.
The `defaultVariants` property specifies the default values for each variant. It determines how a component looks and behaves when no prop is provided.
::framework-only
#nuxt
:::tip
These default values can be customized in your [`app.config.ts`](#config) to adjust the standard appearance of components throughout your application.
:::
#vue
:::tip
These default values can be customized in your [`vite.config.ts`](#config) to adjust the standard appearance of components throughout your application.
:::
::
## Customize theme
You have multiple ways to customize the appearance of Nuxt UI components, you can do it for all components at once or on a per-component basis.
::note
Tailwind Variants uses [tailwind-merge](https://github.com/dcastil/tailwind-merge) under the hood to merge classes so you don't have to worry about conflicting classes.
Tailwind Variants uses [`tailwind-merge`](https://github.com/dcastil/tailwind-merge) under the hood to merge classes so you don't have to worry about conflicting classes.
::
::tip
You can explore the theme for each component in two ways:
- Check the `Theme` section in the documentation of each individual component.
- Browse the source code directly in the GitHub repository at https://github.com/nuxt/ui/tree/v3/src/theme.
- Browse the source code directly in the GitHub repository at [`v3/src/theme`](https://github.com/nuxt/ui/tree/v3/src/theme).
::
### `app.config.ts`
### Config
You can override the theme of components inside your `app.config.ts` by using the exact same structure as the theme object.
::framework-only
#nuxt
::div
You can override the theme of components globally inside your `app.config.ts` by using the exact same structure as the theme object.
Let's say you want to change the font weight of all your buttons, you can do it like this:
@@ -503,14 +780,47 @@ export default defineAppConfig({
}
})
```
::
#vue
::div
You can override the theme of components globally inside your `vite.config.ts` by using the exact same structure as the theme object.
Let's say you want to change the font weight of all your buttons, you can do it like this:
```ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'
export default defineConfig({
plugins: [
vue(),
ui({
ui: {
button: {
slots: {
base: 'font-bold'
}
}
}
})
]
})
```
::
::
::note
In this example, the `font-bold` class will override the default `font-medium` class on all buttons.
::
### `ui` prop
### Props
You can also override a component's **slots** using the `ui` prop. This has priority over the `app.config.ts` configuration and `variants` resolution.
#### `ui` prop
You can also override a component's **slots** using the `ui` prop. This has priority over the global configuration and `variants` resolution.
::component-code{slug="button"}
---
@@ -539,9 +849,9 @@ slots:
In this example, the `trailingIcon` slot is overwritten with `size-3` even though the `md` size variant would apply a `size-5` class to it.
::
### `class` prop
#### `class` prop
The `class` prop allows you to override the classes of the `root` or `base` slot. This has priority over the `app.config.ts` configuration and `variants` resolution.
The `class` prop allows you to override the classes of the `root` or `base` slot. This has priority over the global configuration and `variants` resolution.
::component-code{slug="button"}
---

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