Skip to content

Style your Stencil apps without stress ๐Ÿ’… Inspired by the original React package, styled-components.

Notifications You must be signed in to change notification settings

NEO97online/stencil-styled-components

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

40 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Stencil Styled-Components

Small library to bring the concept of styled-components to StencilJS.

Installation

npm i stencil-styled-components

Usage

import { Component } from '@stencil/core'
import styled from 'stencil-styled-components'

const StyledDiv = styled.div`
  display: inline-block;
  background-color: ${props => props.invert ? 'black' : 'white'};
  color: ${props => props.invert ? 'white' : 'black'};
  width: 100px;
  height: 100px;

  &:hover {
    border: 1px solid #448aff;
  }
`

@Component({
  tag: 'my-component'
})
export class MyComponent {
  render() {
    return (
      <div>
        <StyledDiv>
          <span>Hey, I'm styled!</span>
        </StyledDiv>
        <StyledDiv invert>
          <span>Hey, I'm inverted with a prop!</span>
        </StyledDiv>
      </div>
    )
  }
}

About

Style your Stencil apps without stress ๐Ÿ’… Inspired by the original React package, styled-components.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •