Skip to content

Conversation

@thetarnav
Copy link
Member

@thetarnav thetarnav commented Feb 16, 2025

Control-flow component for matching discriminated union (tagged union) members.

type MyUnion = {
  kind: 'foo',
  foo:  'foo-value',
} | {
  kind: 'bar',
  bar:  'bar-value',
}

const [value, setValue] = createSignal<MyUnion>({kind: 'foo', foo: 'foo-value'})
 
<Match on={value()} case={{
  foo: v => <>{v().foo}</>,
  bar: v => <>{v().bar}</>,
}} />

@changeset-bot
Copy link

changeset-bot bot commented Feb 16, 2025

⚠️ No Changeset found

Latest commit: 075ecce

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@thetarnav thetarnav marked this pull request as draft February 16, 2025 17:35
@thetarnav thetarnav marked this pull request as ready for review May 31, 2025 11:40
@chiefcll
Copy link
Contributor

chiefcll commented Aug 5, 2025

Any progress on releasing this? I'd like to add it to the lightning demo app

@thetarnav thetarnav merged commit cfe0620 into main Aug 6, 2025
2 checks passed
@thetarnav thetarnav deleted the match-component branch August 6, 2025 11:10
@thetarnav
Copy link
Member Author

I'll just release it. If there are any issues—make an issue.

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.

3 participants