
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
native-system-components
Advanced tools
Create consistent design-system-driven React UI components across native platforms
Built with styled-system, with support for styled-components & emotion
import system from 'system-components'
// creates a Box with default props tied to your theme
const Box = system({
p: 2,
bg: 'blue'
})
Or, to use with emotion:
import system from 'system-components/emotion'
To create a styled-component with default props that hook into styled-system props, pass a plain object as the first argument to the system
function.
const Card = system({
px: 2,
py: 3,
borderWidth: 1,
borderColor: 'lightGray',
borderRadius: 2
})
The system function will automatically apply styled-system functions
to the underlying styled-component based on the keys of the defaultProps
object.
System components also add prop type definitions and remove style props from the underlying HTML element.
See the styled-system docs for a complete list of the available style functions.
System components can also be created with styled-system props without defining defaultProps
.
const Box = system(
'space',
'width',
'color'
)
This allows for style props to be passed to the component instance:
<Box
width={1/2}
px={3}
py={4}
bg='blue'
/>
Custom style functions can be passed as an argument.
const Box = system(
props => ({
height: props.height
})
)
System components default to using a <div>
as the HTML element.
To change the HTML element use the is
prop.
const Heading = system({
is: 'h2',
m: 0,
fontSize: 6
})
Since is
is a prop, it can also be passed to the element when used.
This is useful for one-off changes to ensure semantic markup.
<Heading is='h1'>
Hello
</Heading>
To extend another component, set it as the default is
prop in your component definition, or pass it as a prop to the component instance.
const Text = system({
fontSize: 2,
})
const Bold = system({
is: Text,
fontWeight: 'bold'
})
To add one-off custom CSS to any system-component, use the css
prop.
<Heading css='opacity:0.75;'>
Hello
</Heading>
The base System
class can be used to create a system-components function for any CSS-in-JS library.
import { System } from 'system-components'
import styled from 'nano-style'
const system = new System({
createComponent: type => (...args) => styled(type)(...args)
})
export default system
FAQs
Create consistent design-system-driven React UI components
The npm package native-system-components receives a total of 8 weekly downloads. As such, native-system-components popularity was classified as not popular.
We found that native-system-components demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.