TheJaredWilcurt / vue-doxen

The world's best Vue.js component documentation tool
http://TheJaredWilcurt.github.io/vue-doxen
MIT License
6 stars 0 forks source link

Support setting the default value on built in prop components #78

Closed TheJaredWilcurt closed 1 month ago

TheJaredWilcurt commented 1 month ago

Maybe one of these:

propsToDemo: {
  font: {
    type: String,
    default: undefined,
    required: true,
    allowed: ['Lora', 'Lato'],
    modelValue: 'Lora'
  }
}
propsToDemo: {
  font: {
    type: String,
    default: undefined,
    required: true,
    allowed: ['Lora', 'Lato'],
    props: {
      modelValue: 'Lora'
    }
  }
}

Putting it in the props section makes more sense to me, as today you would have to do this:

propsToDemo: {
  font: {
    type: String,
    default: undefined,
    required: true,
    allowed: ['Lato', 'Lora'],
    component: DoxenRadioDials,
    props: {
      label: 'Font',
      options: [
        { name: 'Lato', value: 'Lato' },
        { name: 'Lora', value: 'Lora' }
      ],
      modelValue: 'Lora'
    }
  }
}

So having a props section work for the provided component, or if not provided, then the built-in one, that makes sense to me. And it would apply to any prop, not just modelValue.

One problem that could arise is people passing in the props for an assumed built in component (Number, Radio), but then later we change what the default component is (Range, Dropdown), and that new component uses those same props in a different way. So may have unexpected, hard-to-track breaking changes in people's apps. But this also feels like an edge case.