Skip to content

Commit

Permalink
fix: Storybook menu overflow behavior and Menu docs for autoSize (#33350
Browse files Browse the repository at this point in the history
)
  • Loading branch information
smhigley authored Nov 27, 2024
1 parent 2fc8151 commit b0af329
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const ThemePicker: React.FC<{ selectedThemeId?: string }> = ({ selectedTh
<Menu
onCheckedValueChange={onCheckedValueChange}
checkedValues={{ theme: selectedThemeId ? [selectedThemeId] : [] }}
positioning={{ autoSize: true }}
>
<MenuTrigger>
<MenuButton className={styles.menuButton} menuIcon={{ className: styles.chevronIcon }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Use the `hasIcons` prop for alignment if only some menu items have icons.
- Use the `hasCheckmarks` prop for alignment if only some menu items are selectable.
- Use `MenuItemLink` if the menu item should navigate to a new page
- Use `positioning={{ autoSize: true }}` if the Menu could potentially be clipped by the top of the page when forced to render above the trigger, or render past the bottom of the page when forced to render below the trigger (these can happen at high zoom or on small devices). Optionally: use `autoSize: true` for all Menus to force them to stay within the viewport and have their own scrollbars if there is overflow.

### Don't

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import { Button, Menu, MenuTrigger, MenuList, MenuItem, MenuPopover } from '@fluentui/react-components';

export const Default = () => (
<Menu>
<Menu positioning={{ autoSize: true }}>
<MenuTrigger disableButtonEnhancement>
<Button>Toggle menu</Button>
</MenuTrigger>
Expand Down

0 comments on commit b0af329

Please sign in to comment.