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

Update Select.mdx #6220

Closed
wants to merge 1 commit into from
Closed

Update Select.mdx #6220

wants to merge 1 commit into from

Conversation

rafighajili
Copy link

added renderValue prop for rendering custom ReactNode inside select button

Closes

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

added renderValue prop for rendering custom ReactNode inside select button
}

function MySelect<T extends object>({label, description, errorMessage, children, items, ...props}: MySelectProps<T>) {
return (
<Select {...props}>
<Label>{label}</Label>
<Button>
<SelectValue />
<SelectValue>
Copy link
Member

Choose a reason for hiding this comment

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

No need to add a prop for renderValue, this would be taken care of like so

<SelectValue>
  {({defaultChildren}) => 
    return defaultChildren; // do any context around this which can be used to pass values to the ListBoxItem and tell it other ways to render
    // this will already handle the props.placeholder and a default placeholder
  }
</SelectValue>

I'm going to close this PR in favor of #6425
Feel free to open an issue if there's anything missed

@snowystinger
Copy link
Member

Closing in favor of #6425

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.

None yet

2 participants