Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

183
Views
Type '{ label: string; }' is not assignable to type 'IntrinsicAttributes & { children?: ReactNode; }'

I am using the Fluent UI, imported the Toggle component and got a UI Toggle exported:

export const UIToggle: React.FunctionComponent = () => {
  return (
    <Stack tokens={stackTokens}>
      <Toggle label="Enabled and checked" defaultChecked onText="On" offText="Off" />
    </Stack>
  );
};

but when I want to use it and update the 'label' attribute:

<UIToggle label = "Turn on"></UIToggle>

here is the error:

Type '{ label: string; }' is not assignable to type 'IntrinsicAttributes & { children?: ReactNode; }'.
  Property 'label' does not exist on type 'IntrinsicAttributes & { children?: ReactNode; }'

Can anyone explain why this error appears and how can I solve it?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I need to provide label as an argument to the interface. With the following revision, it is working well now

import * as React from 'react';
import { Stack, IStackTokens } from '@fluentui/react/lib/Stack';
import { Toggle } from '@fluentui/react/lib/Toggle';

const stackTokens: IStackTokens = { childrenGap: 10 };

interface ILabels {
  label: string
}
export const UIToggle: React.FunctionComponent<ILabels> = (props) => {
  return (
    <Stack tokens={stackTokens}>
      <Toggle label={props.label} defaultChecked onText="On" offText="Off" />
    </Stack>
  );
};
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!