UiView
v2.3.2This component SHOULD wrap your entire app tree
This component will set up the global styles and providers for @uireact to work properly.
- Theme context provider
- Dialogs context provider
- Global styles
- Notifications context provider
Installation ⚙️
npm i @uireact/foundation @uireact/view
Examples 🤓
UiView
This doc page is wrapped in a < UiView />
component
This is an example of our wrapper:
export const ViewExample: React.FC = () => {const [selectedTheme, setTheme] = React.useState<ThemeColor>(ThemeColor.light);const toogleTheme = () => {setTheme(selectedTheme === ThemeColor.light ? ThemeColor.dark : ThemeColor.light);};return (<UiView theme={DefaultTheme} selectedTheme={selectedTheme}><p>All the react tree should render inside here</p><UiButton onClick={toogleTheme}>Toggle theme</UiButton></UiView>);};
UiViewRow
The UiViewRow
component is used to separate parts of the content of the application.
ViewRowExample definition:
export const ViewRowExample: React.FC = () => {const [selectedTheme, setTheme] = React.useState<ThemeColor>(ThemeColor.light);const toogleTheme = () => {setTheme(selectedTheme === ThemeColor.light ? ThemeColor.dark : ThemeColor.light);};return (<UiView theme={DefaultTheme} selectedTheme={selectedTheme}><UiViewRow weight="10"><p>A row with weight 10</p></UiViewRow><UiViewRow weight="50" centeredContent><p>A row with weight 50</p></UiViewRow><UiViewRow><p>A row with default theme</p></UiViewRow><UiViewRow weight="150"><p>A row with weight 150</p></UiViewRow><UiViewRow weight="200"><p>A row with weight 200</p></UiViewRow><UiViewRow weight="200" noBackground><p>A row without background color</p></UiViewRow><UiViewRow inverseFont category="negative"><p>Row with inverse font and category</p></UiViewRow><UiButton onClick={toogleTheme}>Toggle theme</UiButton></UiView>);};
Props 🛠️
UiView
dialogController
IDialogController | undefined
centeredContent
boolean | undefined
selectedTheme
ThemeColor
required
theme
Theme
required
noBackground
boolean | undefined
UiViewRow
category
ColorCategory | undefined
primary
centeredContent
boolean | undefined
inverseFont
boolean | undefined
weight
"10" | "50" | "100" | "150" | "200" | undefined
noBackground
boolean | undefined