Adding a custom component isn't working with schema
See original GitHub issue- Nuxt 3
- @formkit/nuxt1.0.0-beta.11
I’m having such a headache lol I’ve been trying to add a multiselect since 3 days and I tried literally everything from the docs. Nothing seems to work.
What I want
- adding the @vueform/multiselect component to the schema, or even better: creating a component FormkitMultiselect which has @vueform/multiselect as a child component
- adding a label to this component in the same style like all other inputs (native formkit text inputs etc.)
- correct value handling
What already works
- having the VueMultiselect rendered with my provided options
Problems
- how to add a label when using a custom component?
- how to handle the data? (v-model) for some reason all values are selected (see screenshot)
I tried everything from the docs… createInput etc., but nothing worked for me.
My Code
@vueform/multiselect is provided globally via Nuxt plugin
import VueMultiselect from '@vueform/multiselect'
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.component("VueMultiselect", VueMultiselect)
})
const schema = ref<FormKitSchemaCondition | FormKitSchemaNode[]>([
{
$formkit: 'text',
name: 'title',
label: 'Recipe Title',
validation: 'required',
value: ''
},
{
$cmp: 'VueMultiselect',
props: {
options: useRecipeBadges()
}
},
])
Passing schema to a wrapper component
<FormBuilder
:schema="schema"
/>
wrapper passes it to FormKit
<FormKit type="form" @submit="handleSubmit" :submit-label="submitLabel">
<FormKitSchema
:schema="schema"
/>
</FormKit>
All values selected
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
CUSTOM_ELEMENTS_SCHEMA added to NgModule ...
This worked for me on TestBed . Element was working fine but test was failing. Added schemas: [NO_ERRORS_SCHEMA] , and it's all good....
Read more >Angular 10 Custom Elements not found · Issue #39115 - GitHub
I used CUSTOM_ELEMENTS_SCHEMA but Custom Element not found ... add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to ...
Read more >You're using CUSTOM_ELEMENTS_SCHEMA wrong.
If you're using Angular together with Web Components, you need to add CUSTOM_ELEMENTS_SCHEMA to your module import, like this:.
Read more >Custom component: is not a known element: - Ionic Framework
I have generate a new ionic component with command: ionic g ... then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this ...
Read more >Custom components | Decentraland Documentation
You may want to add a component that simply flags an entity to differentiate it from others, without using it to store any...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for the reproduction. I saw a number of issues that needed resolving, but rather than list them all out, here’s your reproduction working: https://stackblitz.com/edit/vueform-multiselect-formkit
Best of luck 👍 And if you enjoy FormKit, consider using our Pro inputs next time to help support the project 🙂
@justin-schroeder thanks for your time!