ui
ui copied to clipboard
Accordion `items` type does not allow custom content
Environment
Stackblitz
Version
2.17.0
Reproduction
- Open the StackBlitz
- Run
npx nuxi typecheck - See error.
Description
When using custom content for the accordion, the types throw an error because content is only allowed to be a string
https://github.com/nuxt/ui/blob/53003fcd07d67d13ada0759ff6c5cd3635fba0e3/src/runtime/types/accordion.d.ts#L6
Additional context
Ideally, AccordionItem would have a generic for content, defaulting to string so we could have autocomplete for the types.
Logs
No response
We can't do much about it in this version unfortunately but we've implemented everything with generics in v3 already: https://github.com/benjamincanac/ui3/blob/9420a686bbcf2aae854915a114fcaa6e4e808021/src/runtime/components/Accordion.vue#L51
@benjamincanac just to understand... i would also like to have a custom accordionitem type and display body default etc slots with custom code... how can i change the items type?
@TheAlexLichter did u find any workaround?
@simonmaass I think I just switched to v3 eventually.
@TheAlexLichter i am also using v3... but not sure how to do it... any help would be greatly appreciated :)
@simonmaass This issue if for v2, would you mind opening a new issue with a reproduction so we can help?
@benjamincanac the issue had the label "v3" - that confused me. sorry