Menu.res
1// === Type definitions ===
2type handle<'payload>
3type actions
4type changeEventDetails
5
6type orientation = [#horizontal | #vertical]
7type align = [#start | #center | #end]
8type side = [#top | #bottom | #left | #right | #inlineEnd | #inlineStart]
9type positionMethod = [#absolute | #fixed]
10
11// === createHandle ===
12@module("@base-ui/react/menu") @scope("Menu")
13external createHandle: unit => handle<'payload> = "createHandle"
14
15// === Root ===
16module Root = {
17 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
18 external make: (
19 ~defaultOpen: bool=?,
20 ~\"open\": bool=?,
21 ~onOpenChange: (bool, changeEventDetails) => unit=?,
22 ~highlightItemOnHover: bool=?,
23 ~closeParentOnEsc: bool=?,
24 ~loopFocus: bool=?,
25 ~modal: bool=?,
26 ~onOpenChangeComplete: bool => unit=?,
27 ~disabled: bool=?,
28 ~orientation: orientation=?,
29 ~children: Jsx.element=?,
30 ) => Jsx.element = "Root"
31}
32
33// === Trigger ===
34module Trigger = {
35 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
36 external make: (
37 ~handle: handle<'payload>=?,
38 ~nativeButton: bool=?,
39 ~disabled: bool=?,
40 ~openOnHover: bool=?,
41 ~delay: int=?,
42 ~closeDelay: int=?,
43 ~children: Jsx.element=?,
44 ~className: string=?,
45 ) => Jsx.element = "Trigger"
46}
47
48// === Portal ===
49module Portal = {
50 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
51 external make: (
52 ~keepMounted: bool=?,
53 ~children: Jsx.element=?,
54 ~className: string=?,
55 ~container: Preact.ref<nullable<Dom.element>>=?,
56 ) => Jsx.element = "Portal"
57}
58
59// === Backdrop ===
60module Backdrop = {
61 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
62 external make: (~className: string=?, ~children: Jsx.element=?) => Jsx.element = "Backdrop"
63}
64
65// === Positioner ===
66module Positioner = {
67 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
68 external make: (
69 ~disableAnchorTracking: bool=?,
70 ~align: align=?,
71 ~alignOffset: int=?,
72 ~side: side=?,
73 ~sideOffset: int=?,
74 ~arrowPadding: int=?,
75 ~sticky: bool=?,
76 ~positionMethod: positionMethod=?,
77 ~className: string=?,
78 ~children: Jsx.element=?,
79 ) => Jsx.element = "Positioner"
80}
81
82// === Popup ===
83module Popup = {
84 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
85 external make: (~children: Jsx.element=?, ~className: string=?) => Jsx.element = "Popup"
86}
87
88// === Viewport ===
89module Viewport = {
90 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
91 external make: (~children: Jsx.element=?, ~className: string=?) => Jsx.element = "Viewport"
92}
93
94// === Arrow ===
95module Arrow = {
96 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
97 external make: (~children: Jsx.element=?, ~className: string=?) => Jsx.element = "Arrow"
98}
99
100// === Item ===
101module Item = {
102 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
103 external make: (
104 ~label: string=?,
105 ~onClick: Dom.event => unit=?,
106 ~closeOnClick: bool=?,
107 ~nativeButton: bool=?,
108 ~disabled: bool=?,
109 ~className: string=?,
110 ~children: Jsx.element=?,
111 ) => Jsx.element = "Item"
112}
113
114// === LinkItem ===
115module LinkItem = {
116 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
117 external make: (
118 ~label: string=?,
119 ~href: string=?,
120 ~closeOnClick: bool=?,
121 ~className: string=?,
122 ~children: Jsx.element=?,
123 ) => Jsx.element = "LinkItem"
124}
125
126// === SubmenuRoot ===
127module SubmenuRoot = {
128 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
129 external make: (
130 ~defaultOpen: bool=?,
131 ~\"open\": bool=?,
132 ~onOpenChange: (bool, changeEventDetails) => unit=?,
133 ~highlightItemOnHover: bool=?,
134 ~closeParentOnEsc: bool=?,
135 ~loopFocus: bool=?,
136 ~onOpenChangeComplete: bool => unit=?,
137 ~disabled: bool=?,
138 ~orientation: orientation=?,
139 ~children: Jsx.element=?,
140 ) => Jsx.element = "SubmenuRoot"
141}
142
143// === SubmenuTrigger ===
144module SubmenuTrigger = {
145 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
146 external make: (
147 ~label: string=?,
148 ~onClick: Dom.event => unit=?,
149 ~nativeButton: bool=?,
150 ~disabled: bool=?,
151 ~openOnHover: bool=?,
152 ~delay: int=?,
153 ~closeDelay: int=?,
154 ~className: string=?,
155 ~children: Jsx.element=?,
156 ) => Jsx.element = "SubmenuTrigger"
157}
158
159// === Group ===
160module Group = {
161 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
162 external make: (~children: Jsx.element=?, ~className: string=?) => Jsx.element = "Group"
163}
164
165// === GroupLabel ===
166module GroupLabel = {
167 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
168 external make: (~className: string=?, ~children: Jsx.element=?) => Jsx.element = "GroupLabel"
169}
170
171// === RadioGroup ===
172module RadioGroup = {
173 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
174 external make: (
175 ~defaultValue: 'value=?,
176 ~value: 'value=?,
177 ~onValueChange: ('value, changeEventDetails) => unit=?,
178 ~disabled: bool=?,
179 ~children: Jsx.element=?,
180 ~className: string=?,
181 ) => Jsx.element = "RadioGroup"
182}
183
184// === RadioItem ===
185module RadioItem = {
186 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
187 external make: (
188 ~value: 'value,
189 ~label: string=?,
190 ~onClick: Dom.event => unit=?,
191 ~closeOnClick: bool=?,
192 ~nativeButton: bool=?,
193 ~disabled: bool=?,
194 ~className: string=?,
195 ~children: Jsx.element=?,
196 ) => Jsx.element = "RadioItem"
197}
198
199// === RadioItemIndicator ===
200module RadioItemIndicator = {
201 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
202 external make: (
203 ~keepMounted: bool=?,
204 ~className: string=?,
205 ~children: Jsx.element=?,
206 ) => Jsx.element = "RadioItemIndicator"
207}
208
209// === CheckboxItem ===
210module CheckboxItem = {
211 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
212 external make: (
213 ~label: string=?,
214 ~defaultChecked: bool=?,
215 ~checked: bool=?,
216 ~onCheckedChange: (bool, changeEventDetails) => unit=?,
217 ~onClick: Dom.event => unit=?,
218 ~closeOnClick: bool=?,
219 ~nativeButton: bool=?,
220 ~disabled: bool=?,
221 ~className: string=?,
222 ~children: Jsx.element=?,
223 ) => Jsx.element = "CheckboxItem"
224}
225
226// === CheckboxItemIndicator ===
227module CheckboxItemIndicator = {
228 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
229 external make: (
230 ~keepMounted: bool=?,
231 ~className: string=?,
232 ~children: Jsx.element=?,
233 ) => Jsx.element = "CheckboxItemIndicator"
234}
235
236// === Separator ===
237module Separator = {
238 @module("@base-ui/react/menu") @scope("Menu") @jsx.component
239 external make: (~orientation: [#horizontal | #vertical]=?, ~className: string=?) => Jsx.element =
240 "Separator"
241}