1. @vue-styled-system/prop-types
Add prop types to Vue components built with Styled System
@vue-styled-system/prop-types
Package: @vue-styled-system/prop-types
Last modified: Thu, 07 Apr 2022 11:28:43 GMT
Version: 5.1.10
License: MIT
Downloads: 4

Install

npm install @vue-styled-system/prop-types
yarn add @vue-styled-system/prop-types

@vue-styled-system/prop-types

Add prop types to Vue components built with Styled System

 npm i styled-system @vue-styled-system/prop-types
 import styled from 'vue-styled-components'
import { space, color } from 'styled-system'
import propTypes from '@vue-styled-system/prop-types'

const boxProps = {
  ...propTypes.space,
  ...propTypes.color,
}

const Box = styled('div', boxProps)(space, color)

Available Type Categories

  • space
  • color
  • layout
  • typography
  • flexbox
  • border
  • background
  • position
  • grid

See props of each category in the reference table.

Custom Props

 import styled from 'vue-styled-components'
import { space, system } from 'styled-system'
import propTypes, { propType } from '@vue-styled-system/prop-types'

const gridGap = system({
  gap: {
    property: 'gridGap',
    scale: 'space',
    defaultScale: [0, 4, 8, 16, 32, 64, 128, 256, 512]
  }
})

const stackProps = {
  ...propTypes.space,
  gap: propType,
}

const Stack = styled('div', stackProps)(
  compose(space, gridGap)
)

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin