Using tooltip for NavBar items #27488
Unanswered
maryamyasaei
asked this question in
General
Replies: 1 comment
-
Fluent UI v8 allows to customize the rendered tree by passing custom render functions to the components. There are multiple ways how you can wrap the individual NavItems:
See https://developer.microsoft.com/en-us/fluentui#/controls/web/nav#INavProps for more details. For your use case, you want to custom-render the entire button, so const LinkAs: React.FunctionComponent<INavButtonProps> = (props) => {
// This example does not set aria attributes for simplification!
return (
<TooltipHost content={props.title ?? props.link?.name}>
<ActionButton {...props} title="" />
</TooltipHost>
);
};
export const NavBasicExample: React.FunctionComponent = () => {
return (
<Nav
// other props
linkAs={LinkAs}
/>
);
}; Keep in mind this is a minimal example not covering accessibility requirements. Codesandbox example: https://codesandbox.io/s/v8-nav-linkas-dbqffi?file=/src/App.tsx |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Environment Information
Describe the issue:
I Want to have tooltip when user click on the Nav items from Nav elements, but Nav elements are Objects, and I cannot wrap them inside tooltip like the example provided in the Doc.
Actual behavior:
Cannot wrap the objects in Nav elements with TooltipHost
Expected behavior:
I want to have tooltip when user click on the items of Nav
If applicable, please provide a codepen repro:
Priorities and help requested (not applicable if asking question):
Are you willing to submit a PR to fix? (Yes, No)
Requested priority: (Blocking)
Products/sites affected: (if applicable)
Beta Was this translation helpful? Give feedback.
All reactions