Kaakao-UI Styled Mixins
A framework-agnostic collection of Styled Components mixins for creating logical CSS styles with appropriate fallbacks.
🤖 Installation
npm install @kaakao-ui/styled-mixins
🔧 Usage
Each mixin will check for an active Styled Components theme by using the useTheme()
hook.
If a theme is present, the values will be used as theme keys. If no theme exists, the values themselves will be used for the styles.
import styled from 'styled-components';
import { Margin } from '@kaakao-ui/styled-mixins';
const Container = styled.section`
${Margin({ m: 1, x: 2 })};
`;
...
📓 Documentation
Mixin | Theme Key | Props | CSS Map |
---|
Margin | theme.space | m b l r t x y | margin margin-block-end / margin-bottom margin-inline-start / margin-left margin-inline-end / margin-right margin-block-start / margin-top margin-inline-start:end / margin-left:right margin-block-start:end / margin-top:bottom |
Padding | theme.space | p b l r t x y | padding padding-block-end / padding-bottom padding-inline-start / padding-left padding-inline-end / padding-right padding-block-start / padding-top padding-inline-start:end / padding-left:right padding-block-start:end / padding-top:bottom |
Space | theme.space | m p | See Margin See Padding |