File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -660,6 +660,43 @@ await snap.request({
660
660
<img src={require("../../assets/custom-ui-row.png").default} alt="Row UI example" width="450px" style={{border: "1px solid #DCDCDC"}} />
661
661
</p >
662
662
663
+ ### ` Selector `
664
+
665
+ Outputs a selector component for use in [ interactive UI] ( interactive-ui.md ) .
666
+
667
+ #### Props
668
+
669
+ - ` name ` : ` string ` - The name that will be used as a key to the event sent to
670
+ [ ` onUserInput ` ] ( ../../reference/entry-points.md#onuserinput ) when the containing form is submitted.
671
+ - ` title ` : ` string ` - The title of the selector, displayed when the selector is opened.
672
+ - ` children ` : ` SelectorOption[] ` - One or more ` SelectorOption ` components, each with a ` Card ` child (see example).
673
+
674
+ #### Example
675
+
676
+ ``` js
677
+ import { Selector , SelectorOption , Card } from " @metamask/snaps-sdk/jsx" ;
678
+
679
+ const interfaceId = await snap .request ({
680
+ method: " snap_createInterface" ,
681
+ params: {
682
+ ui: (
683
+ < Selector name= " selector-example" title= " Select an option" >
684
+ < SelectorOption value= " option-1" >
685
+ < Card title= " Option 1" value= " First option" / >
686
+ < / SelectorOption>
687
+ < SelectorOption value= " option-2" >
688
+ < Card title= " Option 2" value= " Second option" / >
689
+ < / SelectorOption>
690
+ < / Selector>
691
+ ),
692
+ },
693
+ });
694
+ ```
695
+
696
+ <p align =" center " >
697
+ <img src={require("../../assets/custom-ui-selector.png").default} alt="Selector UI example" width="450px" style={{border: "1px solid #DCDCDC"}} />
698
+ </p >
699
+
663
700
### ` Spinner `
664
701
665
702
Outputs a loading indicator.
You can’t perform that action at this time.
0 commit comments