diff --git a/src/components/menu/menu.mdx b/src/components/menu/menu.mdx index 541528d4..c7ae692b 100644 --- a/src/components/menu/menu.mdx +++ b/src/components/menu/menu.mdx @@ -14,22 +14,22 @@ More features will be added to Menu in the future -## Styles Only Usage +## Default -Default style of the `Menu`, can set `data-alignment` to "right" to move the x-position to the right of the button +By default, the `Menu` is left-aligned, but this can be adjusted using the `data-alignment`. Additionally (for React user), the vertical position of the Menu is automatically adjusted based on the available space below the trigger and `window` each time the menu is opened (can use `yOffset` to have more adjustment). - +`closeMenu`={false} can be set to keep the menu open when it is clicked. - +Note: `closeMenu` and `yOffset` are react only props. -## React Usage + -In the React Usage, you can compose your component using `Menu` component as example here + -And the y-position of the menu will be automatically adjusted based on the available space below the trigger and `window` each time the menu is opened +## With Alignment -`closeMenu`={false} or `data-close-menu`="false" (note: this is only for React users) can be set to keep the menu open when it is clicked." +Example for `Menu` with right Alignment. - + - + diff --git a/src/components/menu/menu.stories.tsx b/src/components/menu/menu.stories.tsx index c215fd11..e2f0bbc5 100644 --- a/src/components/menu/menu.stories.tsx +++ b/src/components/menu/menu.stories.tsx @@ -1,59 +1,21 @@ import type { Meta, StoryObj } from '@storybook/react' -import { - ElMenu, - ElMenuItemAnchor, - ElMenuItemButton, - ElMenuItemGroup, - ElMenuItemGroupTitle, - ElMenuList, - ElMenuPopover, - Menu, -} from '.' +import type { ComponentProps } from 'react' +import { Menu } from '.' import { Button } from '../button' import { Icon } from '../icon' -import type { ComponentProps } from 'react' import { FlexContainer } from '../layout' const meta: Meta = { title: 'Components/Menu', - argTypes: { - 'data-alignment': { - control: 'inline-radio', - options: ['left', 'right'], - description: - 'to control the alignment of Menu container, will default to left if not provided (please see `More Complex Usage Example` for interactive example)', - }, - }, } export default meta type Story = StoryObj -export const StylesOnlyUsage: StoryObj = { +export const Default: StoryObj = { render: () => { return ( - - - - - Group Title - Menu Item - Menu Item - - Menu Item as anchor - - - - - - ) - }, -} - -export const ReactUsage: Story = { - render: (props) => { - return ( - + {({ getTriggerProps }) => + + ) + }, +} + +export const MoreComplexUsageExample: Story = { render: (props) => { const NavDropdownButtonUsageExample = ({ title,