Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ToggleGroup): ✨ New ToggleGroup component #813

Merged
merged 43 commits into from
Sep 28, 2023

Conversation

Magnusrm
Copy link
Contributor

@Magnusrm Magnusrm commented Sep 13, 2023

ToggleGroup

  • Adds a new ToggleGroup component which can be populated by ToggleGroup.Items and allow for one of the items to be active by handling the value of the ToggleGroup.
  • The ToggleGroups value can be both controlled using state and uncontrolled.
  • When using the ToggleGroup uncontrolled, it is recommended to set a default value using the property defaultValue.
  • The ToggleGroup is using RovingTabindexRoot as a div, and the ToggleGroup.Item is using RovingTabindexItem as a designsysstem Button.

Roving Tabindex:

  • Tab navigation in the ToggleGroup is handled by the new RovingTabindex utility component.
  • The RovingTabindex feature allows for wrapping a bunch of the extensible component RovingTabindexItem in the extensible component RovingTabindexRoot. You can then tab in and out of the RovingTabindexRoot and only one of the items will be focused.
  • You can also move focus left and right using the arrow keys.

Example usage:

import { ToggleGroup } from '@digdir/design-system-react';

<ToggleGroup defaultValue="value1">
  <ToggleGroup.Item value="value1">Option 1</ToggleGroup.Item>
  <ToggleGroup.Item value="value2">Option 2</ToggleGroup.Item>
  <ToggleGroup.Item value="value3">Option 3</ToggleGroup.Item>
</ToggleGroup>;

Resolves: #805

@Magnusrm Magnusrm changed the title feat(ToggleGroup): Create new ToggleGroup component feat(ToggleGroup): ✨ New ToggleGroup component Sep 14, 2023
@Magnusrm Magnusrm changed the title feat(ToggleGroup): ✨ New ToggleGroup component feat(ToggleGroup): ✨ New ToggleGroup component Sep 14, 2023
@Magnusrm Magnusrm force-pushed the feat/toggle-group-component branch from 9d45959 to b14b3c6 Compare September 27, 2023 13:35
@Magnusrm Magnusrm marked this pull request as ready for review September 27, 2023 14:21
@Magnusrm Magnusrm added the 📔 storybook storybook.designsystemet.no label Sep 27, 2023
@Magnusrm Magnusrm marked this pull request as draft September 27, 2023 14:22
@Magnusrm Magnusrm marked this pull request as ready for review September 27, 2023 14:22
@github-actions
Copy link
Contributor

Storybook preview deployment is available at https://storybook-2ke3oh28q-designsystemet.vercel.app

Copy link
Collaborator

@mimarz mimarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh boy! Nice work on the Roving utility component 👌

Looks very good, mostly just feedback on some docs and clean code.

ohboy-golden-girls

@mimarz
Copy link
Collaborator

mimarz commented Sep 28, 2023

Suggest also updating the Overview.mdx to point to this new "felles" component :)

@Magnusrm Magnusrm marked this pull request as draft September 28, 2023 07:07
@Magnusrm Magnusrm marked this pull request as ready for review September 28, 2023 07:34
@github-actions
Copy link
Contributor

Storybook preview deployment is available at https://storybook-b69hri3mk-designsystemet.vercel.app

@Magnusrm Magnusrm marked this pull request as draft September 28, 2023 07:44
@Magnusrm Magnusrm marked this pull request as ready for review September 28, 2023 07:44
@github-actions
Copy link
Contributor

Storybook preview deployment is available at https://storybook-1ko0pw5a3-designsystemet.vercel.app

Copy link
Collaborator

@mimarz mimarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more suggestions on docs else looking good! 👍

@Magnusrm Magnusrm merged commit bc45c2e into main Sep 28, 2023
2 checks passed
@Magnusrm Magnusrm deleted the feat/toggle-group-component branch September 28, 2023 11:12
Barsnes pushed a commit that referenced this pull request Sep 28, 2023
Co-authored-by: Michael Marszalek <[email protected]>
Co-authored-by: Michael Marszalek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📔 storybook storybook.designsystemet.no
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ToggleGroup: Develop React component
3 participants