Vueless Docs
ComponentsGitHubWebsite
  • Getting Started
  • Installation
    • Quick start (Vue)
    • Quick start (Nuxt)
    • Class autocompletion
    • Minimal requirements
    • Storybook docs
  • Global customization
    • General
    • Colors
    • Design system
    • Rounding
    • Focus Outline
    • Font Size
    • Disabled Opacity
    • Dark mode
    • Custom tailwind classes
  • Component customization
    • General
    • Styling
    • Unstyled mode
    • Conditional styling
    • Extends styling from keys
    • Nested components styling
    • Props defaults
    • Redefining props
    • Defining custom props
    • Internationalization (i18n)
  • Creating own components
    • Vueless file structure
    • Create new component
    • Copy existing component
  • Svg Icons
    • General usage
    • Custom icons
    • Dynamic import
    • Advanced settings
  • Helpers
    • Change settings in runtime
  • Other
    • Vueless Vite Plugins
Powered by GitBook
On this page
  1. Component customization

Redefining props

Sometimes, you might need to limit possible prop values, add new ones, or hide certain props in Storybook documentation. To achieve this, you can redefine prop settings using the props key in the component’s config.

vueless.config.{js,ts}
export default {
  component: {
    UButton: {
      props: [
        /* 
         * Restrict color values to a provided list of items.
         * Use this to align the prop entirely with the design system.
         */
        { 
          name: "color",
          values: ["blue", "green", "yellow", "brand"],
        },

        /* 
         * Add a new, previously non-existent value, `ghost`.
         * Use this to fully align the prop with the design system.
         * For examle, if the design system includes variant not present in Vueless.
         */
        { 
          name: "variant",
          values: ["primary", "secondary", "thirdary", "ghost"],
        },
         
        /* 
         * Hide the prop in Storybook.
         * For example, if the design system lacks related styles
         * and the prop serves no purpose.
         */
        {
          name: "filled",
          ignore: true,
        }
      }
    }
  }
};

Last updated 5 months ago