0.8.0 â€Ē Published 1 year ago

@seed-ui/layout v0.8.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Seed UI

codecov

@seed-ui/layout

Components and style-utilities for creating responsive layouts.

  • 💅 Styled with SCSS. You can import SCSS to use build-in mixins and variables.
  • ðŸŠķ Uses utility-first approach and CSS variables for dynamic styles, so final CSS is much smaller.
  • 💊 Has simple API typed with TypeScript.
  • 🍞 Compatible with any UI-kit. This package is responsible only for layouts.
  • 🛠ïļ Includes reusable style-utils for creating new components and styles.
  • 🍂 Allows tree-shaking. Unused code can be removed by Webpack or another bundler with tree-shaking support.

Install

yarn add @seed-ui/layout

API

Container

Used for sizing and spacings around wrapped components.

import { Container } from '@seed-ui/layout';

function Page() {
  return (
    <Container
      margin={[0, 'auto']}
      maxWidth={{
        xs: 1,
        sm: 540,
        md: 720,
        lg: 960,
        xl: 1140,
        xxl: 1320
      }}
      padding={[0, 2]}
      width={1}
    >
      {/** Inner content  **/}
    </Container>
  )
}

Container props

NameDescriptionDefault value
asElementType'div'
heightResponsiveValue\<Sizing>-
marginResponsiveValue\<Spacing>-
maxHeightResponsiveValue\<Sizing>-
maxWidthResponsiveValue\<Sizing>-
minHeightResponsiveValue\<Sizing>-
minWidthResponsiveValue\<Sizing>-
paddingResponsiveValue\<Spacing>-
elementPropsAllHTMLAttributes\<HTMLElement>-

Row and Col

Used for grid layouts. Must be used together.

import { Row, Col } from '@seed-ui/layout';

function Page() {
  return (
    <Row
      align="center"
      justify={{ xs: 'center', md: 'start' }}
      gutter={[3, 4]}
    >
      <Col xs={6} md={4} xl="auto" >
        {/** Inner content **/}
      </Col>

      <Col xs={6} md={4} xl="auto" >
        {/** Inner content **/}
      </Col>
    </Row>
  )
}

Row props

NameDescriptionDefault value
asElementType'div'
alignResponsiveValue\<Align>-
justifyResponsiveValue\<Justify>-
gutterResponsiveValue\<RowGutter>-
elementPropsAllHTMLAttributes\<HTMLElement>-

Col props

NameDescriptionDefault value
asElementType'div'
xsColSpan-
smColSpan-
mdColSpan-
lgColSpan-
xlColSpan-
xxlColSpan-
orderResponsiveValue\<number>-
alignResponsiveValue\<Align>''
elementPropsAllHTMLAttributes\<HTMLElement>-

Space

Wraps child components into additional divs and creates spacings between them.

import { Space } from '@seed-ui/layout';

function Page() {
  return (
    <Space
      align="start"
      justify="cener"
      gutter={3}
    >
      <Button>Button 1</Button>
      <Button>Button 2</Button>
    </Space>
  )
}

Space props

NameDescriptionDefault value
asElementType'div'
align\<Align>-
direction\<Direction>-
justify\<Justify>-
gutter\<Sizing>-
elementPropsAllHTMLAttributes\<HTMLElement>-

Bar

Used for sizing, position and offsets.

import { Bar } from '@seed-ui/layout';

function Page() {
  return (
    <Bar
      height={56}
      left={0}
      position="fixed"
      top={0}
      width={1}
    >
      {/** Inner content **/}
    </Bar>
  )
}

Bar props

NameDescriptionDefault value
asElementType'div'
heightResponsiveValue\<Sizing>-
maxHeightResponsiveValue\<Sizing>-
maxWidthResponsiveValue\<Sizing>-
minHeightResponsiveValue\<Sizing>-
minWidthResponsiveValue\<Sizing>-
offsetResponsiveValue\<Offset>-
positionResponsiveValue\<Position>-
elementPropsAllHTMLAttributes\<HTMLElement>-

Background

Used for background-images.

import { Bar } from '@seed-ui/layout';

function Page() {
  return (
    <Background
      backgroundImage={{
        xs: 'pictue.jpg',
        md: 'pictue-md.jpg',
        xl: 'pictue-xl.jpg',
      }}
      backgroundRepeat="no-repeat"
      backgroundSize="cover"
    >
      {/** Inner content **/}
    </Background>
  )
}

Background props

NameDescriptionDefault value
asElementType'div'
backgroundImageResponsiveValue\<string>-
backgroundPositionResponsiveValue\<BackgroundPosition>-
backgroundRepeatResponsiveValue\<BackgroundPosition>-
backgroundSizeResponsiveValue\<BackgroundSize>-
elementPropsAllHTMLAttributes\<HTMLElement>-

Hidden

Hides elements according to screen size.

import { Hidden } from '@seed-ui/layout';

function Page() {
  return (
    <Hidden
      lgUp
      smDown
    >
      {/** Inner content **/}
    </Hidden>
  )
}

Hidden props

NameDescriptionDefault value
asElementType'div'
xsDownboolean-
smboolean-
smDownboolean-
smUpboolean-
mdboolean-
mdDownboolean-
mdUpboolean-
lgboolean-
lgDownboolean-
lgUpboolean-
xlboolean-
xlDownboolean-
xlUpboolean-
xxlUpboolean-
elementPropsAllHTMLAttributes\<HTMLElement>-

Types

NameDescription
MaybeT | null | undefined
PairT, T
Sizingnumber | string
SpacingSizing | Sizing, Sizing | Sizing, Sizing, Sizing | Sizing, Sizing, Sizing, Sizing
Align'start' | 'end' | 'center' | 'baseline' | 'stretch'
BackgroundXPosition'left' | 'center' | 'right' | Sizing
BackgroundYPosition'top' | 'center' | 'bottom' | Sizing
BackgroundPositionBackgroundXPosition | BackgroundYPosition | BackgroundYPosition, BackgroundXPosition
BackgroundRepeatValue'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y' | 'round' | 'space'
BackgroundRepeatBackgroundRepeatValue | Pair\<Omit\<BackgroundRepeatValue, 'repeat-x' | 'repeat-y'>>
BackgroundSize'contain' | 'cover' | Pair\<Sizing>
Direction'column' | 'column-reverse' | 'row' | 'row-reverse'
Justify'start' | 'end' | 'center' | 'space-between' | 'space-around' | 'space-evenly'
OffsetSpacing
Position'absolute' | 'fixed' | 'relative' | 'static' | 'sticky'
RowGuterSizing | Pair\<Sizing>
ResponsiveValueObject{ xs?: Maybe\<T>, sm: Maybe\<T>, md?: Maybe\<T>, lg?: Maybe\<T>, xl?: Maybe\<T>, xxl?: Maybe\<T> }
ResponsiveValueT | ResponsiveValueObject\<T>
0.8.0

1 year ago

0.7.2

1 year ago

0.7.1

1 year ago

0.7.0

1 year ago

0.6.2

1 year ago

0.5.0

2 years ago

0.6.1

1 year ago

0.6.0

2 years ago

0.4.3

2 years ago

0.4.1

2 years ago

0.4.2

2 years ago

0.3.12

2 years ago

0.4.0

2 years ago

0.3.9

2 years ago

0.3.11

2 years ago

0.3.10

2 years ago

0.3.6

2 years ago

0.3.8

2 years ago

0.3.7

2 years ago

0.3.5

2 years ago

0.3.2

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.0

3 years ago

0.3.1

3 years ago

0.2.0

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.0

3 years ago