Skip to content

[Bug]: Tailwind v4 prefix tw: in Calendar #1268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks
Rhejie opened this issue May 26, 2025 · 2 comments
Open
2 tasks

[Bug]: Tailwind v4 prefix tw: in Calendar #1268

Rhejie opened this issue May 26, 2025 · 2 comments
Labels
question Further information is requested

Comments

@Rhejie
Copy link

Rhejie commented May 26, 2025

Reproduction

https://stackblitz.com/edit/vitejs-vite-xazktkvt?file=README.md

Describe the bug

prevent-deselect is not working on the calendar, the selected date is not working, and disabled dates

System Info

npx 10.8.2, shadcn-vue, tailwindcss v4, prefix tw:

Contributes

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests
@Rhejie Rhejie added the bug Something isn't working label May 26, 2025
@Rhejie
Copy link
Author

Rhejie commented May 26, 2025

I manually fix CalendarCellTrigger, I update the class's data attribute to
`<CalendarCellTrigger
data-slot="calendar-cell-trigger"
:class="cn(
buttonVariants({ variant: 'ghost' }),
'tw:size-8 tw:p-0 tw:font-normal aria-selected:tw:opacity-100 tw:cursor-default',
'[&[data-today]:not([data-selected])]:tw:bg-accent [&[data-today]:not([data-selected])]:tw:text-accent-foreground',
// Selected
'tw:data-[selected]:bg-primary tw:data-[selected]:text-primary-foreground tw:data-[selected]:opacity-100 tw:data-[selected]:hover:bg-primary tw:data-[selected]:hover:text-primary-foreground tw:data-[selected]:focus:bg-primary tw:data-[selected]:focus:text-primary-foreground',
// Disabled
'tw:data-[disabled]:text-muted-foreground tw:data-[disabled]:opacity-50',
// Unavailable
'tw:data-[unavailable]:text-destructive-foreground tw:data-[unavailable]:line-through',
// Outside months
'tw:data-[outside-view]:text-muted-foreground',
props.class,
)"
v-bind="forwardedProps"

<slot />

`

@sadeghbarati
Copy link
Collaborator

sadeghbarati commented May 26, 2025

Hi check this Stackblitz

https://stackblitz.com/edit/vitejs-vite-hftf1ovm?file=components.json

You are using prefix in component.json wrong

- "prefix": "tw:"
+ "prefix": "tw"

For now install shadcn-vue like (after new release just use npx shadcn-vue@latest)

npm i https://pkg.pr.new/shadcn-vue@1266

Then add shadcn-vue to the package.json scripts then use it like

npm run shadcn-vue init/add

@sadeghbarati sadeghbarati added question Further information is requested and removed bug Something isn't working labels May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants