import { useState } from 'react' import Div from '../Div' import Span from '../typography/Span' import Br from '../Br' import Row from '../Row' import { Sandbox } from '@startupjs/docs' # Div Div is a wrapper for a group of components, which can be clickable when getting the property `onPress`. ```jsx import { Div } from '@startupjs/ui' ``` ## Example ```jsx example const divStyle = { width: 150, height: 100, alignItems: 'center', justifyContent: 'center', backgroundColor: '#00AED6' } const [counter, setCounter] = useState(0) return (
Not clickable

setCounter(counter + 1)} > Clicked {counter} times
) ``` ## Multiple Div in a Row When multiple Div(s) are used in a [`Row`](/docs/en/components/Row) spacing between them can be adjusted using `pushed` prop to specify indent from the previous Div. Possible values of `pushed` prop can be found in the `Sandbox` section at the bottom of the page. The `true` value of prop is equivalent to `m` value. ```jsx example const divStyle = { width: 100, height: 80, textAlign: 'center', justifyContent: 'center', backgroundColor: '#00AED6' } return (
Div 1
Div 2
Div 3
Div 4
) ``` ## Different clickable states There are two clickable variants of component, controlled by `variant` property. `opacity` variant - on press down, opacity of the component is decreased. `highlight` variant - on press down, the opacity of the component background is decreased. ```jsx example const divStyle = { width: 100, height: 80, textAlign: 'center', justifyContent: 'center', backgroundColor: '#00AED6' } return (
{}}> Div opacity variant
{}}> Div highlight variant
) ``` ## Levels of emphasis Div `level` property determines different levels of emphasis by adding shadow to component. Possible values of `level` prop can be found in the `Sandbox` section at the bottom of the page. ```jsx example const divStyle = { width: 100, height: 80, textAlign: 'center', justifyContent: 'center' } return (
Div level 1
Div level 4
) ``` ## Sandbox