question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Props spread in from external package aren't documenting

See original GitHub issue

Current behavior

I have a core component library that I publish to npm, and then extend those core components in a Nuxt project that I am building out. To do that I import each core component from node_modules into my project base components, and spread the core component props in, in order to keep the props in sync. Example:

<template>
    <zr-button class="base-button" v-bind="$props">
        <slot></slot>
        <base-icon v-if="icon"
                   class="btn-icon"
                   :icon="icon">
        </base-icon>
    </zr-button>
</template>

<script>
  import ZrButton from '@zaneray/vue-components/components/base/ZrButton.vue';

  /**
   * Button component that leverages the Zaneray BaseButton documented at https://zr-vue.netlify.com/#/Base%20Components/ZrButton
   */

  export default {
    name: "BaseButton",
    components: {
      ZrButton
    },
    props: {
      ...ZrButton.props,
      /**
       * Icon to display in the button.
       */
      icon: {
        type: String
      }
    }
  }
</script>

This BaseButton component documentation then renders as so: Screen Shot 2019-12-06 at 1 56 22 PM

…where the icon prop is documented, but the props spread in from ZrButton are not documented.

The spread props are properly available for use on on the BaseButton component, even though they are not documented.

I am using the latest version of Vue Styleguidist: 4.1.1

To reproduce In a Vue component that is documented with VSG, import another Vue component from a library like https://www.npmjs.com/package/@zaneray/vue-components . Spread the props of the imported component into the props of the component you are documenting, and see that the spread props do not make it through to the documentation

Expected behavior I would expect that the props spread in from the imported component are documented in VSG just like normal props would be.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:20 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
elevatebartcommented, Dec 11, 2019

If you do not mind, though, I will create anoter request to be able to prarse vuetify export format.

1reaction
jcchrrrcommented, Dec 11, 2019

Ahah, I’ll look at this

Read more comments on GitHub >

github_iconTop Results From Across the Web

How passing props to component works in React
Master how to pass props (properties) to components in React with this useful beginner's guide, including demo code.
Read more >
eslint-plugin-react/jsx-props-no-spreading.md at master - GitHub
Disallow JSX prop spreading ( react/jsx-props-no-spreading )​​ Enforces that there is no spreading for any JSX attribute. This enhances readability of code by ......
Read more >
React does not recognize the X prop on a DOM element ...
In the above scenario, I am spreading {...props} to both Button and CopyToClipboard components. But some props of CopyToClipboard are not ...
Read more >
How to Use React Context to Share Data between Components
This guide will focus on a built-in solution in the React library called React Context. Sharing Data Between Components. Spreading Props to ...
Read more >
How To Customize React Components with Props
They look like standard HTML props, but they aren't predefined and ... They serve as both documentation and an error checker that will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found