Skip to content

How to add a tooltip to Switch #30564

Answered by pradeept95
15MariamS asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @15MariamS
You can use Tooltip component to achieve this. Following is an example that might help you.

import { Label, Switch, Tooltip } from "@fluentui/react-components";

function App() {

  return (
    <>
      <Tooltip content={"This is tooltip content."} relationship={"label"}>
        <Switch label={<Label>Tooltip on switch control</Label>} />
      </Tooltip>
      <Switch label={<>
        <Tooltip content={"This is tooltip content"} relationship={"label"}>
          <Label>Tooltip on label</Label>
        </Tooltip></>} />
    </>
  )
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by 15MariamS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants