🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

react-styled-spacer

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-styled-spacer

Spacer component for margins in react and react-native

Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

React Styled Spacer

A versatile spacing component used to represent whitespace in your layout for both React and React-Native.

Installation

npm i react-styled-spacer

Usage

import Spacer from 'react-styled-spacer'
import { ThemeProvider } from 'styled-components'

const Article = () => (
  <ThemeProvider theme={{ spacers: { small: 10 } }}>
    <div>
      <h1>Lorem ipsum</h1>
      {/* Any value can be used, will default to pixels */}
      <Spacer h={20} />
      <p>Lorem ipsum</p>
      {/* Works with styled-components theming context */}
      <Spacer h="small" />
      <ul>
        {/* Will space between children if provided */}
        <Spacer h={20}>
          <li>A</li>
          <li>B</li>
          <li>C</li>
        </Spacer>
      </ul>
    </div>
  </ThemeProvider>
)

Props

Propertytyperequireddescription
hstring, numberfalseSpecifies spacer height
wstring, numberfalseSpecifies spacer width
growstring, numberfalseflex-grow property for flexbox use
shrinkstring, numberfalseflex-shrink property for flexbox use

Keywords

react

FAQs

Package last updated on 04 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts