|
2 | 2 |
|
3 | 3 | `SuperSpinner` is a dropdown selector component in Miuix that provides titles, summaries, and a list of options with icons and text. It supports click interaction and various display modes, commonly used in option settings with visual aids. This component is similar to `SuperDropdown` but offers richer functionality and interaction experience. |
4 | 4 |
|
5 | | -<div style="position: relative; max-width: 700px; height: 282px; border-radius: 10px; overflow: hidden; border: 1px solid #777;"> |
| 5 | +<div style="position: relative; max-width: 700px; height: 262px; border-radius: 10px; overflow: hidden; border: 1px solid #777;"> |
6 | 6 | <iframe id="demoIframe" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none;" src="../compose/index.html?id=superSpinner" title="Demo" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin"></iframe> |
7 | 7 | </div> |
8 | 8 |
|
|
15 | 15 | ```kotlin |
16 | 16 | import top.yukonga.miuix.kmp.extra.SuperSpinner |
17 | 17 | import top.yukonga.miuix.kmp.extra.SpinnerEntry |
18 | | -import top.yukonga.miuix.kmp.extra.SpinnerMode |
19 | 18 | ``` |
20 | 19 |
|
21 | 20 | ## Basic Usage |
@@ -108,51 +107,7 @@ SuperSpinner( |
108 | 107 | ) |
109 | 108 | ``` |
110 | 109 |
|
111 | | -## Display Modes |
112 | | - |
113 | | -SuperSpinner supports different display modes: |
114 | | - |
115 | | -### Normal Mode (Adaptive to Click Position) |
116 | | - |
117 | | -```kotlin |
118 | | -var selectedIndex by remember { mutableStateOf(0) } |
119 | | -val options = listOf( |
120 | | - SpinnerEntry(title = "Option 1"), |
121 | | - SpinnerEntry(title = "Option 2"), |
122 | | - SpinnerEntry(title = "Option 3") |
123 | | -) |
124 | | - |
125 | | -Scaffold { |
126 | | - SuperSpinner( |
127 | | - title = "Normal Mode", |
128 | | - items = options, |
129 | | - selectedIndex = selectedIndex, |
130 | | - onSelectedIndexChange = { selectedIndex = it }, |
131 | | - mode = SpinnerMode.Normal // Default value |
132 | | - ) |
133 | | -} |
134 | | -``` |
135 | | - |
136 | | -### Always on Right Mode |
137 | | - |
138 | | -```kotlin |
139 | | -var selectedIndex by remember { mutableStateOf(0) } |
140 | | -val options = listOf( |
141 | | - SpinnerEntry(title = "Option 1"), |
142 | | - SpinnerEntry(title = "Option 2"), |
143 | | - SpinnerEntry(title = "Option 3") |
144 | | -) |
145 | | - |
146 | | -Scaffold { |
147 | | - SuperSpinner( |
148 | | - title = "Always on Right Mode", |
149 | | - items = options, |
150 | | - selectedIndex = selectedIndex, |
151 | | - onSelectedIndexChange = { selectedIndex = it }, |
152 | | - mode = SpinnerMode.AlwaysOnRight // Always on right mode |
153 | | - ) |
154 | | -} |
155 | | -``` |
| 110 | +## Dialog Mode |
156 | 111 |
|
157 | 112 | ### Display Dropdown Menu in Dialog |
158 | 113 |
|
@@ -188,7 +143,6 @@ Scaffold { |
188 | 143 | | summary | String? | Selector description | null | No | |
189 | 144 | | summaryColor | BasicComponentColors | Summary text color config | BasicComponentDefaults.summaryColor() | No | |
190 | 145 | | leftAction | @Composable (() -> Unit)? | Custom left content | null | No | |
191 | | -| mode | SpinnerMode | Display mode | SpinnerMode.Normal | No | |
192 | 146 | | modifier | Modifier | Component modifier | Modifier | No | |
193 | 147 | | insideMargin | PaddingValues | Internal content padding | BasicComponentDefaults.InsideMargin | No | |
194 | 148 | | maxHeight | Dp? | Maximum dropdown height | null | No | |
|
0 commit comments