Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vtex/admin-primitives

Package Overview
Dependencies
Maintainers
66
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vtex/admin-primitives

[![NPM](https://img.shields.io/npm/v/@vtex/admin-primitives.svg)](https://www.npmjs.com/package/@vtex/admin-primitives)

  • 0.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
66
Created
Source

Primitives

NPM

Primitives are polymorphic components

Getting started

This package is already a part of admin-ui - so if you are using it, there is no need for installation.

For standalone usage, you can install it as an npm package (with its peer dependencies):

yarn add @vtex/admin-primitives @vtex/admin-core reakit @emotion/css @emotion/react

After that, you must add the admin-core's ThemeProvider on your app root - so that you can consume styles.

import { Flex } from '@vtex/admin-primitives'

function ApplicationRoot() {
  return <Flex>A flex container</Flex>
}

Engineering

csx prop

This prop is present in all components and is responsible for receiving a style-object. More info Styles

<Primitive csx={{ bg: 'blue', color: 'light.primary' }}>Blue box</Primitive>s

Polymorphism

All primitives are polymorphic, this means that you can assign different elements to them through the element property.

The default element is the div, this is true to every component:

<Primitive>renders a div</Primitive>

You can choose the element to render:

<Primitive element="a" href="#">
  renders an anchor
</Primitive>

You can also pass a valid React component (it must receive className so that styles are passed correctly):

import { Link } from 'gatsby'

function Example() {
  return <Primitive element={Link}>Gatsby link</Primitive>
}

Types

PrimitiveProps
proptyperequireddescription
elementE🚫Element that will be rendered
classNamestring🚫element className
extends <E>props of E🚫This component inherits all props of E
FlexProps
proptyperequireddescription
EPrimitiveProps<E>🚫Extends all props of Primitive
alignResponsiveValue<AlignContent>🚫Shorthand for CSS alignItems property
basisResponsiveValue<FlexBasis>🚫Shorthand for CSS flexbasis property
directionResponsiveValue<FlexDirection>🚫Shorthand for CSS flexDirection property
growResponsiveValue<FlexGrow>🚫Shorthand for CSS flexGrow property
shrinkResponsiveValue<FlexShrink>🚫Shorthand for CSS flexShrink property
justifyResponsiveValue<JustifyContent>🚫Shorthand for CSS justifyContent property
wrapResponsiveValue<FlexWrap>🚫Shorthand for CSS flexWrap property
orderResponsiveValue<Order>🚫Shorthand for CSS order property
FlexSpacerProps
proptyperequireddescription
EPrimitiveProps<E>🚫Extends all props of Primitive
GridProps
proptyperequireddescription
EPrimitiveProps<E>🚫Extends all props of Primitive
gapResponsiveValue<GridGap>🚫Shorthand for CSS gridGap property
rowGapResponsiveValue<GridRowGap>🚫Shorthand for CSS gridRowGap property
columnGapResponsiveValue<GridColumnGap>🚫Shorthand for CSS gridColumnGap property
templateAreasstring[]🚫Shorthand for CSS gridTemplateAreas property
templateRowsResponsiveValue<GridTemplateRows>🚫Shorthand for CSS gridTemplateRows property
templateColumnsResponsiveValue<GridTemplateColumns>🚫Shorthand for CSS gridTemplateColumns property
GridItemProps
proptyperequireddescription
EPrimitiveProps<E>🚫Extends all props of Primitive
areaResponsiveValue<GridArea>🚫Shorthand for CSS gridArea property

FAQs

Package last updated on 30 Aug 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc