Skip to content

Commit e64706a

Browse files
committed
add example
1 parent 79fe190 commit e64706a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

packages/react-core/src/components/MenuToggle/examples/MenuToggle.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,14 @@ In the following example, the toggle fills the width of its parent as the window
179179

180180
```
181181

182+
### Toggle in a form
183+
184+
When a menu toggle is used inside a form, pass the `isInForm` property so the toggle receives form-appropriate styling.
185+
186+
```ts file="MenuToggleInForm.tsx"
187+
188+
```
189+
182190
### Typeahead toggle
183191

184192
To create a typeahead toggle, pass in `variant="typeahead"` to the `<MenuToggle>`. Then, pass a `<TextInputGroup>` component as a child of the `<MenuToggle>`.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { MenuToggle } from '@patternfly/react-core';
2+
3+
export const MenuToggleInForm = (): JSX.Element => (
4+
<MenuToggle isInForm aria-label="Menu toggle in a form">
5+
In form
6+
</MenuToggle>
7+
);

0 commit comments

Comments
 (0)