How to use the @uifabric/react-hooks.useId function in @uifabric/react-hooks

To help you get started, we’ve selected a few @uifabric/react-hooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / Tooltip / examples / Tooltip.Display.Example.tsx View on Github external
export const TooltipDisplayExample: React.FunctionComponent = () => {
  // Use useId() to ensure that the ID is unique on the page.
  // (It's also okay to use a plain string and manually ensure uniqueness.)
  const tooltip1Id = useId('tooltip1');
  const tooltip2Id = useId('tooltip2');

  return (
    <div>
      In some cases when a TooltipHost is wrapping <code>inline-block</code> or <code>inline</code> elements, the positioning of the Tooltip
      may be off. In these cases, it's recommended to set the TooltipHost's <code>display</code> property to <code>inline-block</code>, as
      in the following example.
      <br>
      <br>
      
        <button aria-describedby="{tooltip1Id}" style="{buttonStyle}">
          Hover for incorrect positioning
        </button>
      {' '}
      </div>
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / Tooltip / examples / Tooltip.Custom.Example.tsx View on Github external
export const TooltipCustomExample: React.FunctionComponent = () =&gt; {
  // Use useId() to ensure that the ID is unique on the page.
  // (It's also okay to use a plain string and manually ensure uniqueness.)
  const tooltipId = useId('tooltip');

  return (
    
      
    
  );
};
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / Tooltip / examples / Tooltip.Display.Example.tsx View on Github external
export const TooltipDisplayExample: React.FunctionComponent = () =&gt; {
  // Use useId() to ensure that the ID is unique on the page.
  // (It's also okay to use a plain string and manually ensure uniqueness.)
  const tooltip1Id = useId('tooltip1');
  const tooltip2Id = useId('tooltip2');

  return (
    <div>
      In some cases when a TooltipHost is wrapping <code>inline-block</code> or <code>inline</code> elements, the positioning of the Tooltip
      may be off. In these cases, it's recommended to set the TooltipHost's <code>display</code> property to <code>inline-block</code>, as
      in the following example.
      <br>
      <br>
      
        <button aria-describedby="{tooltip1Id}" style="{buttonStyle}">
          Hover for incorrect positioning
        </button>
      {' '}
      </div>
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / Tooltip / examples / Tooltip.Basic.Example.tsx View on Github external
export const TooltipBasicExample: React.FunctionComponent = () =&gt; {
  // Use useId() to ensure that the ID is unique on the page.
  // (It's also okay to use a plain string and manually ensure uniqueness.)
  const tooltipId = useId('tooltip');

  return (
    <div>
      
        Hover over me
      
    </div>
  );
};
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / Tooltip / examples / Tooltip.Interactive.Example.tsx View on Github external
export const TooltipInteractiveExample: React.FunctionComponent = () =&gt; {
  // Use useId() to ensure that the ID is unique on the page.
  // (It's also okay to use a plain string and manually ensure uniqueness.)
  const tooltipId = useId('tooltip');

  return (
    <div>
      
        Interact with my tooltip
      
    </div>
  );
};
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / Tooltip / examples / Tooltip.Overflow.Example.tsx View on Github external
export const TooltipOverflowExample: React.FunctionComponent = () =&gt; {
  const parentTooltipId = useId('text-tooltip');
  const [shouldOverflow, setShouldOverflow] = React.useState(false);
  const [isParentTooltipVisible, setIsParentTooltipVisible] = React.useState(false);

  const onOverflowChange = React.useCallback(() =&gt; setShouldOverflow(!shouldOverflow), [shouldOverflow]);

  return (
    <div>
      

      {/* Example of TooltipOverflowMode.Parent */}
      <div>
        <label>Show tooltip when parent's content overflows</label>

        {/* This parent element will overflow */}
        <div>
          This is the parent element.</div></div></div>
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / ChoiceGroup / examples / ChoiceGroup.Label.Example.tsx View on Github external
export const ChoiceGroupLabelExample: React.FunctionComponent = () =&gt; {
  // Use the useId() hook to ensure that the label ID is unique on the page. Notes:
  // - It's also okay to use a plain string and manually ensure its uniqueness.
  // - In a function component, we get the ID with the useId() hook so that it will stay the same.
  //   (In a class, you'd create the ID in the constructor with getId and save it in a private member.)
  const labelId = useId('labelElement');

  return (
    <div>
      <label required="{true}" id="{labelId}">
        Custom label
      </label>
      </div>
github Kanaries / Rath / packages / frontend / src / pages / dataSource / index.tsx View on Github external
insightBoard: false,
      fieldConfig: false,
      configPanel: false,
      dataConfig: false
    }
  })
  const [cleanMethod, setCleanMethod] = useState('dropNull');
  const [sampleMethod, setSampleMethod] = useState(SampleKey.none)
  const [sampleSize, setSampleSize] = useState(0.2);

  const dataSetting = useRef(null);
  const fileEle = useRef(null);

  const [dataSource, preparedData] = useDataSource(state.rawData, state.fields, cleanMethod);

  const labelId = useId('labelElement');

  async function fileUploadHanlder () {
    if (fileEle.current !== null &amp;&amp; fileEle.current.files !== null) {
      const file = fileEle.current.files[0];
      /**
       * tmpFields is fields cat by specific rules, the results is not correct sometimes, waitting for human's input
       */
      let tmpFields: BIField[] = [];
      let rawData: DataSource = [];

      if (file.type === 'text/csv' || file.type === 'application/vnd.ms-excel') {
        rawData = await FileLoader.csvLoader(file);
      } else if (file.type === 'application/json') {
        rawData = await FileLoader.jsonLoader(file);
      } else {
        throw new Error(`unsupported file type=${file.type} `)

@uifabric/react-hooks

Fluent UI React hooks.

MIT
Latest version published 2 years ago

Package Health Score

75 / 100
Full package analysis