UNPKG

carbon-react

Version:

A library of reusable React components for easily building user interfaces.

31 lines (30 loc) 1.64 kB
import React, { ReactNode } from "react"; import { MarginProps, PaddingProps } from "styled-system"; import { IconType } from "../../../icon"; export type ResponsiveVerticalMenuItemClickEvent = React.MouseEvent<HTMLButtonElement | HTMLAnchorElement> | React.KeyboardEvent<HTMLButtonElement | HTMLAnchorElement>; interface BaseItemProps extends MarginProps, PaddingProps { /** The content of the menu item. This will render the menu item as a parent menu. */ children?: ReactNode; /** Custom icon to be displayed. Takes precedence over `icon` if both are specified. */ customIcon?: ReactNode; /** External URL or anchor link for standard HTML navigation. Providing this will render the menu item as an anchor link. */ href?: string; /** The Carbon icon to be displayed. Defers to `customIcon` if both are defined. */ icon?: IconType; /** The unique identifier for the menu item. */ id: string; /** The label for the menu item. */ label: React.ReactNode; /** A custom click handler to run when an anchor link is clicked */ onClick?: (event: ResponsiveVerticalMenuItemClickEvent) => void; /** The rel attribute to be used for the underlying <a> tag */ rel?: string; /** The target to use for the menu item. */ target?: string; } export interface ResponsiveVerticalMenuItemProps extends Omit<BaseItemProps, "id"> { /** The unique identifier for the menu item. */ id?: string; } export declare const ResponsiveVerticalMenuItem: ({ children, id, label, ...props }: ResponsiveVerticalMenuItemProps) => React.JSX.Element; export default ResponsiveVerticalMenuItem;