Skip to content

[ButtonGroup]: stretch JSDoc says @default true, the component defaults it to false #1001

Open

Description

@Juhantam

Problem

stretch JSDoc is incorrect. button-group.tsx:31 says @default true, but the component destructures stretch = false at button-group.tsx:79. The tedi-button-group--stretch class is applied only when the prop is truthy (button-group.tsx:173), and that modifier is the only thing giving the items flex: 1 (button-group.module.scss:120-124). A group rendered without the prop sizes its buttons to their content, which is the opposite of what the props table says.

Storybook builds the props table from these tags (reactDocgen: 'react-docgen-typescript', .storybook/main.ts:45), so the wrong default is published there too.

The two lines have never agreed in this repo. Both are already present in bc880e5, the commit that moved React to a standalone repo, and the three later commits to the file left them untouched. Still the case in 19.1.1 and on main.

Solution

  1. Change the JSDoc to @default false. Non-breaking, and matches what the component does.
  2. Or change the destructured default to true to match the documented intent. That changes the layout of every existing group that doesn't pass the prop, so it would need a major.

Examples and information

Storybook: TEDI-Ready/Components/Buttons/ButtonGroup

Render a group whose buttons have labels of different lengths and pass no stretch. The docs say the buttons take equal space; each one sizes to its label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    tedi-readyTEDI-Ready component issue

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions