-
Notifications
You must be signed in to change notification settings - Fork 438
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
add asChild prop to UI components #6110
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
size-limit report 📦
|
8e0f77d
to
7bda6cd
Compare
🦋 Changeset detectedLatest commit: 7bda6cd The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
TL;DR
Added
asChild
prop support to UI components, enabling better composition with custom elements.What changed?
asChild
prop to various UI components includingSiteLink
,AccountAddress
,AccountAvatar
,AccountBalance
,AccountName
,ChainIcon
,ChainName
,NFTDescription
,NFTName
,TokenIcon
,TokenName
,TokenSymbol
,WalletIcon
, andWalletName
@radix-ui/react-slot
as a new dependencyHow to test?
asChild
prop along with a custom elementWhy make this change?
This change provides more flexibility in component composition, allowing developers to customize the rendered elements while maintaining the core functionality. This is particularly useful for:
PR-Codex overview
This PR focuses on allowing the
asChild
prop for most UI components, enabling them to render as a different component (likeSlot.Root
) rather than the default HTML element. This enhances flexibility in component usage.Detailed summary
asChild
prop to various components.Slot.Root
ifasChild
is true.SiteLink
,AccountAddress
,NFTName
,NFTDescription
,AccountName
,WalletName
,ChainName
,ChainIcon
,AccountBalance
,AccountAvatar
,TokenIcon
,TokenSymbol
,TokenName
,WalletIcon
, andSocialIcon
.package.json
files to update@radix-ui/react-slot
version to1.1.1
.