Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(ui-menu): target prop support for MenuItem #1608

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/ui-menu/src/Menu/MenuItem/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ type MenuItemOwnProps = {
* Value of the `href` prop that will be put on the underlying DOM element.
*/
href?: string
/**
* Where to display the linked URL, as the name for a browsing context (a tab, window, or <iframe>).
*/
target?: string
}

type PropKeys = keyof MenuItemOwnProps
Expand Down Expand Up @@ -115,7 +119,8 @@ const propTypes: PropValidators<PropKeys> = {
as: PropTypes.elementType, // eslint-disable-line react/require-default-props
type: PropTypes.oneOf(['button', 'checkbox', 'radio', 'flyout']),
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
href: PropTypes.string
href: PropTypes.string,
target: PropTypes.string,
}

const allowedProps: AllowedPropKeys = [
Expand All @@ -132,7 +137,8 @@ const allowedProps: AllowedPropKeys = [
'as',
'type',
'value',
'href'
'href',
'target'
]
type MenuItemState = {
selected: boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-menu/src/Menu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Example extends React.Component {
mountNode={() => document.getElementById('main')}
>
<Menu.Item value="mastery">Learning Mastery</Menu.Item>
<Menu.Item href="https://instructure.github.io/instructure-ui/">Default (Grid view)</Menu.Item>
<Menu.Item href="https://instructure.github.io/instructure-ui/" target="_blank">Default (Grid view)</Menu.Item>
<Menu.Item disabled>Individual (List view)</Menu.Item>
<Menu label="More Options">
<Menu.Group
Expand Down
Loading