horror
😱 React HTML elements with CSS-in-JS
npm i horror styled-components
Quick Start
To create a Horror starter project, run:
npm init horror my-horror-project
Usage
import React from 'react'import Div H1 from 'horror' <Div => <H1 => Horror </H1> </Div>
- Includes all HTML elements
- Use object literal or CSS syntax
- Style any component
- Support for styled-components or emotion
HTML Tags
Changing the underlying HTML tag can be done in any of the following ways:
- Importing the tag directly:
import { Header } from 'horror'
- Using a key on the default import:
<Horror.header />
- Using the
is
prop:<Horror is='header' />
- Using the styled-components API:
const H1 = Horror.withComponent('h1')
Using Custom Components
To use a custom component, pass it to the is
prop:
import React from 'react'import Link from 'react-router-dom'import H from 'horror' const RedLink = <H = = />
Creating Style Components
Horror can be used to create component primitive abstractions, similar to using styled-components or react-emotion, but with a more React-like syntax.
import React from 'react'import H from 'horror' const Button = primary ...props <H.button = /> ButtondisplayName = 'Button'
Emotion
Horror also works with emotion:
npm i emotion react-emotion
import H from 'horror/emotion'