0

How do you create components with React fluentui and apply styling to root and child components?

Amit
  • 29
  • 4
  • Fluent usually allows you to do that via `styles` prop or custom `onRender` function. Can you make your question more specific like what components exactly you would want to style? – MartinT Jan 08 '22 at 14:21
  • Hi @MartinT I am trying build custom component in flentui using Stack and StackItem component. I need to set styles for children inside the Stack component using class name. I used to handle styling using styled-components earlier. Can you please tell me how can that be done in fluentui? – Amit Jan 09 '22 at 06:05
  • For custom components (not-dependend on Fluent) you are free to use whatever styling you wish - styled components for example. If you want to restyle existing Fluent components on the other hand, Fluent uses CSS-in-JS. For a more concrete help, you will have to provide some code samples. – MartinT Jan 09 '22 at 19:24
  • Hi @MartinT I tried below styling code: `const styles = { root: { /* styles */ }, child1: { /* styles */ }, child2: { /* styles */ } subComponentStyles: { subComponent: { root: { /* styles */ }, child1: { /* styles */ }, } } }` Can you please tell me how to add it to child components. CSS code I add inside child1 and child2 doesn't apply to children. For component I am using: ` Hello ` – Amit Jan 10 '22 at 03:46
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Jan 17 '22 at 22:55

0 Answers0