Coder Social home page Coder Social logo

kt3k / styled-components Goto Github PK

View Code? Open in Web Editor NEW

This project forked from styled-components/styled-components

0.0 3.0 0.0 5.1 MB

Visual primitives for the component age πŸ’…

Home Page: http://styled-components.com

License: MIT License

JavaScript 97.40% HTML 0.64% TypeScript 1.96%

styled-components's Introduction

styled-components

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress πŸ’…

npm install --save styled-components

npm Join the community on Spectrum

gzip size size module formats: umd, cjs, esm

Utilising tagged template literals (a recent addition to JavaScript) and the power of CSS, styled-components allows you to write actual CSS code to style your components. It also removes the mapping between components and styles – using components as a low-level styling construct could not be easier!

styled-components is compatible with both React (for web) and ReactNative – meaning it's the perfect choice even for truly universal apps! See the documentation about ReactNative for more information.

Note: If you're not using npm as your package manager, aren't using a module bundler or aren't sure about either of those jump to Alternative Installation Methods.

Made by Glen Maddern, Max Stoiber and Phil PlΓΌckthun, supported by Front End Center and Thinkmill. Thank you for making this project possible!

Docs

See the documentation at styled-components.com/docs for more information about using styled-components!

Quicklinks

Quicklinks to some of the most-visited pages:

Linting

There is (currently experimental) support for stylelint – meaning you can take advantage of 150 rules to make sure your styled-components CSS is solid!

Recording of stylelint correctly reporting errors in a styled components' CSS

See the stylelint-processor-styled-components repository for installation instructions.

Syntax highlighting

The one thing you lose when writing CSS in template literals is syntax highlighting. We're working hard on making proper syntax highlighting happening in all editors. We currently have support for Atom, Visual Studio Code, and soon Sublime Text.

This is what it looks like when properly highlighted:

Syntax highlighted styled component

Atom

@gandm, the creator of language-babel, has added support for styled-components in Atom!

To get proper syntax highlighting, all you have to do is install and use the language-babel package for your JavaScript files!

Sublime Text

There is an open PR by @garetmckinley to add support for styled-components to babel-sublime! (if you want the PR to land, feel free to πŸ‘ the initial comment to let the maintainers know there's a need for this!)

As soon as that PR is merged and a new version released, all you'll have to do is install and use babel-sublime to highlight your JavaScript files!

Visual Studio Code

The vscode-styled-components extension provides syntax highlighting inside your Javascript files. You can install it as usual from the Marketplace.

VIM / NeoVim

The vim-styled-components plugin gives you syntax highlighting inside your Javascript files. Install it with your usual plugin manager like Plug, Vundle, Pathogen, etc.

Also if you're looking for an awesome javascript syntax package you can never go wrong with YAJS.vim.

Other Editors

We could use your help to get syntax highlighting support to other editors! If you want to start working on syntax highlighting for your editor, open an issue to let us know.

Built with styled-components

Libraries

Grid Systems

Helpers

  • styled-props: Simple lib that allows you to set styled props in your styled-components without stress (demo)
  • styled-components-breakpoint: Utility function for using breakpoints with styled-components.
  • styled-theme: Extensible theming system for styled-components.
  • styled-tools: Useful interpolated functions for styled-components.
  • styled-ax: Functional theme property accessor(s)
  • react-create-component-from-tag-prop: Create a react component from a tag prop. Lets your users to choose which HTML elements get styled by your πŸ’… styled-components.
  • styled-components-theme: A library for refering to theme colors and modifying them inline. e.g. color: ${primary.lighten(0.3)};

Boilerplates

Websites

Other

Built something with styled-components? Submit a PR and add it to this list!

Further Reading

These are some great articles and talks about related topics in case you're hungry for more:

Alternative Installation Methods

If you're not using a module bundler or not using npm as your package manager, we also have a global ("UMD") build!

You can use that via the unpkg CDN to get styled-components, the URL is https://unpkg.com/styled-components/dist/styled-components.min.js.

To install styled-components with bower you'd do:

bower install styled-components=https://unpkg.com/styled-components/dist/styled-components.min.js

To use it from your HTML, add this at the bottom of your index.html, and you'll have access to the global window.styled variable:

<script src="https://unpkg.com/styled-components/dist/styled-components.min.js" type="text/javascript"></script>

Other solutions

If styled-components isn't quite what you're looking for, maybe something in this list is:

  • glamorous - basically styled-components but using JS objects and functions instead of strings.

License

Licensed under the MIT License, Copyright Β© 2017 Glen Maddern and Maximilian Stoiber.

See LICENSE for more information.

Acknowledgements

This project builds on a long line of earlier work by clever folks all around the world. We'd like to thank Charlie Somerville, Nik Graf, Sunil Pai, Michael Chan, Andrey Popp, Jed Watson & Andrey Sitnik who contributed ideas, code or inspiration.

Special thanks to @okonet for the fantastic logo.

styled-components's People

Contributors

amilajack avatar bhough avatar brunolemos avatar btmills avatar didierfranc avatar diegohaz avatar evenchange4 avatar geelen avatar haikyuu avatar igorbek avatar jacobp100 avatar jameslnewell avatar jamiedixon avatar k15a avatar kitten avatar kristojorg avatar marc-rutkowski avatar michalkvasnicak avatar mxstbr avatar orta avatar patrick91 avatar relekang avatar rich-harris avatar ryyppy avatar sheepsteak avatar siddharthkp avatar stephenkingsley avatar thisguychris avatar vdanchenkov avatar yasserkaddour avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.