Giter Club home page Giter Club logo

Comments (2)

alfonsobries avatar alfonsobries commented on July 17, 2024

I have no experience with storybook (I have plans to use for the next version of the docs), anyway, you can install the plugin normally? with the Vue.use( syntax?

Ask because it's possible to install a single component but you should use the same syntax you use to install the library since the installation process is when the props are overridden, to do that you need to import the component with this path: vue-tailwind/dist/components/{componentName}

example import ComponentName from 'vue-tailwind/dist/components/ComponentName.umd.js'

So for your specific case, the component should be added like this:

import TButton from 'vue-tailwind/dist/components/TButton.umd.js'

Vue.use(TButton, {
   fixedClasses: 'button',
  variants: {
    primary: 'is-primary'
  }
})

Notice that this is not in the docs, the main reason is that I am not happy with the approach I followed and is something I want to change in the next version of the package that very likely will accept a syntax like the one you are using.

Let me know if that syntax helps you, I am very interested in making this library works with storybook

from vue-tailwind.

dsfx3d avatar dsfx3d commented on July 17, 2024

@alfonsobries the plugin works fine, it was a mistake on my end.
Instead of using the globally registered component in the story, I was importing the component and then using it.

The story should look like this if someone else faces this issue in future:

import { TButton } from 'vue-tailwind'

export default {
  title: 'Example/Button',
  component: TButton,
  argTypes: {
    variant: {
      control: { type: 'select', options: ['', 'primary'] }
    },
    onClick: { action: 'click' }
  }
}

const Template = (_args, { argTypes }) => ({
  props: Object.keys(argTypes),
  // The component is already globally registered and configured,
  // do not register the component locally
  // components: { TButton },
  template: `
    <t-button @click="onClick" v-bind="$props">
      Button
    </t-button>`
})

export const Primary = Template.bind({})
Primary.args = {
  variant: 'primary'
}

from vue-tailwind.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.