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

UseControllableState-API #2585

Merged
merged 12 commits into from
Jan 11, 2024
Merged

UseControllableState-API #2585

merged 12 commits into from
Jan 11, 2024

Conversation

KenAJoh
Copy link
Collaborator

@KenAJoh KenAJoh commented Dec 28, 2023

Description

Kopiert fra chakra, men først sett i Radix

Målet med useControllableState er å forenkle logikk brukt når komponent kan både være styrt av intern eller ekstern state. Man sikrer da at defaultValue, open-state og onChange blir håndtert riktig, og ikke minst likt på tvers av komponenter

const [_open, _setOpen] = useControllableState({
      defaultValue: defaultOpen,
      value: open,
      onChange: onOpenChange,
    });

Copy link

changeset-bot bot commented Dec 28, 2023

🦋 Changeset detected

Latest commit: a5e0e53

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@navikt/ds-react Minor
@navikt/ds-css Minor
@navikt/ds-tokens Minor
@navikt/ds-tailwind Minor
@navikt/aksel-icons Minor
@navikt/aksel Minor
@navikt/aksel-stylelint Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Dec 28, 2023

Storybook demo

33cd67eda | 61 komponenter | 400 stories

@KenAJoh KenAJoh merged commit 76eefdf into main Jan 11, 2024
2 checks passed
@KenAJoh KenAJoh deleted the use-controllable branch January 11, 2024 09:05
@github-actions github-actions bot mentioned this pull request Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants