-
Notifications
You must be signed in to change notification settings - Fork 563
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
feat: add dropdown component #2420
Conversation
d80ff2d
to
8531f5c
Compare
@metamaskbot update-pr |
* @property name - The name of the dropdown. This is used to identify the | ||
* state in the form data. | ||
*/ | ||
type DropdownProps = { |
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.
Maybe we should support a placeholder
and default option here?
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.
Default option is the same as using value
. The underlying DS component (which uses plain HTML) doesn't support a placeholder
so I would vote we put that off
aa8a6a2
to
e322bae
Compare
Adds support for a
Dropdown
component, that can be used on its own or as part of aField
.Similarly to
Input
, it optionally usesvalue
to determine the initial value/preselected dropdown item. This can also be used to control the input when re-rendering withsnap_updateInterface
. The dropdown will also triggerInputChangeEvent
similarly to anInput
.This PR mostly adds validation and types for this new component as well as some handling for the form state. This will need a follow-up PR in the extension to complete integration. This PR also adds support for
selectInDropdown
tosnaps-jest
and uses this new component in the Interactive UI example Snap.Progresses https://github.com/MetaMask/MetaMask-planning/issues/1575