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 menuWidth & expose align props in ComboBox and SearchAutocomplete #5446
Conversation
packages/@react-spectrum/autocomplete/src/SearchAutocomplete.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Reid Barber <reid@reidbarber.com>
GET_BUILD |
Build successful! 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good, one small suggestion.
Note to team, before merging, please run chromatic.
GET_BUILD |
Build successful! 🎉 |
## API Changes
unknown top level export { type: 'any' } @react-spectrum/autocompleteSection SpectrumSearchAutocompleteProps<T> {
+ align?: Alignment = 'start'
defaultInputValue?: string
defaultItems?: Iterable<T>
direction?: 'bottom' | 'top' = 'bottom'
icon?: ReactElement | null
inputValue?: string
isQuiet?: boolean
items?: Iterable<T>
loadingState?: LoadingState
menuTrigger?: MenuTriggerAction = 'input'
+ menuWidth?: DimensionValue
onInputChange?: (string) => void
onLoadMore?: () => void
onOpenChange?: (boolean, MenuTriggerAction) => void
onSubmit?: (string | null, Key | null) => void
}
@react-spectrum/comboboxSection SpectrumComboBoxProps<T> {
+ align?: Alignment = 'start'
allowsCustomValue?: boolean
defaultInputValue?: string
defaultItems?: Iterable<T>
direction?: 'bottom' | 'top' = 'bottom'
formValue?: 'text' | 'key' = 'text'
inputValue?: string
isQuiet?: boolean
items?: Iterable<T>
loadingState?: LoadingState
menuTrigger?: MenuTriggerAction = 'input'
+ menuWidth?: DimensionValue
onInputChange?: (string) => void
onOpenChange?: (boolean, MenuTriggerAction) => void
shouldFlip?: boolean = true
shouldFocusWrap?: boolean
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closes #5430
Hello, this PR adds a new prop
menuWidth
to bothComboBox
andSearchAutocomplete
React Spectrum components. This prop is identical to that of Picker's, which allows the user to specify the width of the popover to their preference.While adding the prop, I noticed the
align
part ofplacement
prop forPopover
used in bothComboBox
andSearchAutocomplete
was fixed toend
. This unfortunately results in the exact opposite positioning toPicker
's popover when the popover width is wider than the trigger element. So to better align withPicker
's behavior, I exposed an additional propalign
and set its default tostart
in bothComboBox
andSearchAutocomplete
. There may be a reason for having 'end' align for both of these components that I'm not aware of, so I'd like a confirmation from the core team about this.Thanks.
✅ Pull Request Checklist:
📝 Test Instructions:
Combobox
story
menuWidth
using 'width' and 'menuWidth' controls in that story.docs
menuWidth
andalign
are listed with proper descriptions.SearchAutocomplete
story
menuWidth
using 'width' and 'menuWidth' controls in that story.docs
menuWidth
andalign
are listed with proper descriptions.🧢 Your Project: