All Projects β†’ styled-components β†’ Elm Styled

styled-components / Elm Styled

Licence: mit
Styling your Html Elements with typed Css πŸ’…

Programming Languages

elm
856 projects

Projects that are alternatives of or similar to Elm Styled

Blazorstyled
CSS in Blazor Components
Stars: ✭ 152 (-15.56%)
Mutual labels:  styled-components
Filbert Js
A lightweight(~1kb) css-in-js framework
Stars: ✭ 167 (-7.22%)
Mutual labels:  styled-components
Bedrock
Foundational Layout Primitives for your React App
Stars: ✭ 173 (-3.89%)
Mutual labels:  styled-components
React Site Nav
A kick ass site menu powered by styled components inspired by Stripe.
Stars: ✭ 155 (-13.89%)
Mutual labels:  styled-components
Tails Ui
πŸ’ Clean UI based on tailwindcss
Stars: ✭ 162 (-10%)
Mutual labels:  styled-components
2019 12
🎟 κΈ‰μ¦ν•˜λŠ” νŠΈλž˜ν”½μ—λ„ μ•ˆμ •μ μΈ μ˜ˆμ•½ μ„œλΉ„μŠ€, Atomic Pattern을 μ μš©ν•œ μž¬μ‚¬μš© κ°€λŠ₯ν•œ μ»΄ν¬λ„ŒνŠΈ, μ‹€μš©μ μΈ Testing을 주제둜 ν•˜λŠ” 이벀트 μ„œλΉ„μŠ€
Stars: ✭ 169 (-6.11%)
Mutual labels:  styled-components
React Redux Styled Hot Universal
react boilerplate used best practices and focus on performance
Stars: ✭ 147 (-18.33%)
Mutual labels:  styled-components
Felipefialho.com
😺 My personal website
Stars: ✭ 177 (-1.67%)
Mutual labels:  styled-components
Gatsby Theme Superstylin
πŸ’… A Gatsby Theme with styled-components
Stars: ✭ 165 (-8.33%)
Mutual labels:  styled-components
Animate Css Styled Components
simple port of animate css for styled-components
Stars: ✭ 173 (-3.89%)
Mutual labels:  styled-components
React App Rewire Styled Components
Add the styled-components Babel plugin to your create-react-app app via react-app-rewired
Stars: ✭ 159 (-11.67%)
Mutual labels:  styled-components
15 Puzzle
The 15-puzzle is a sliding puzzle that consists of a frame of numbered square tiles in random order with one tile missing, built in react
Stars: ✭ 161 (-10.56%)
Mutual labels:  styled-components
React Adminlte Dash
This project is No Longer Maintained. React implementation of AdminLTE themed dashboard
Stars: ✭ 170 (-5.56%)
Mutual labels:  styled-components
Styled Bootstrap
πŸ’…πŸ» A styled-component implementation of Bootstrap
Stars: ✭ 154 (-14.44%)
Mutual labels:  styled-components
React Simon Says
A "Simon Says" game built with React and Redux πŸ‘Ύ
Stars: ✭ 175 (-2.78%)
Mutual labels:  styled-components
Goober
πŸ₯œ goober, a less than 1KB πŸŽ‰ css-in-js alternative with a familiar API
Stars: ✭ 2,317 (+1187.22%)
Mutual labels:  styled-components
Storybook Addon Styled Component Theme
storybook addon
Stars: ✭ 168 (-6.67%)
Mutual labels:  styled-components
Grid
This package has moved and renamed
Stars: ✭ 2,079 (+1055%)
Mutual labels:  styled-components
Ran
⚑ RAN! React . GraphQL . Next.js Toolkit ⚑ - SEO-Ready, Production-Ready, SSR, Hot-Reload, CSS-in-JS, Caching, CLI commands and more...
Stars: ✭ 2,128 (+1082.22%)
Mutual labels:  styled-components
React Elastic Carousel
A flexible and responsive carousel component for react https://sag1v.github.io/react-elastic-carousel
Stars: ✭ 173 (-3.89%)
Mutual labels:  styled-components

Unreleased! At the moment I can't release this package to the elm package manager because it is using Native code. If you still want to expirement with it you can install it directly from GitHub. ❀️

elm-styled logo

Use typed CSS inside your Elm files to style your Html elements.

elm-package install styled-components/elm-styled

Usage

Basic

This creates two Elm functions, title and wrapper.

import Html exposing (..)
import Styled exposing (..)
import Styled.Colors exposing (pink, lightYellow)


title =
    styled h1
        [ fontSize (Styled.em 1.5)
        , textAlign center
        , color pink
        , fontFamily monospace
        ]


wrapper =
    styled div
        [ padding (Styled.em 4)
        , backgroundColor lightYellow
        ]

You render them like every other Elm node.

main =
    wrapper []
        [ title []
            [ text "Hello World, this is my first styled function πŸ’…" ]
        ]
Screenshot of the above code ran in a browser πŸ’…

Overriding Styles

We can create a simple button function and using this function to create a new styled function. The new styled function will have all of the styles from both styled functions.

import Html exposing (div, text)
import Styled exposing (..)
import Styled.Colors exposing (white, pink)


button =
    styled Html.button
        [ backgroundColor white
        , color pink
        , fontSize (Styled.em 1)
        , margin (Styled.em 1)
        , padding2 (Styled.em 0.25) (Styled.em 1)
        , border (px 2) solid pink
        , borderRadius (px 3)
        ]


primaryButton =
    styled button
        [ backgroundColor pink
        , color white
        ]


main =
    div
        []
        [ button [] [ text "Normal" ]
        , primaryButton [] [ text "Primary" ]
        ]
Screenshot of the above code ran in a browser πŸ’…

Dynamic Styles

If you want to have dynamic styles you can create a function which will return a styled function.

import Html exposing (..)
import Styled exposing (..)
import Styled.Colors exposing (red, yellow, green)


light paint =
    styled div
        [ backgroundColor paint
        , borderRadius (percent 50)
        , display inlineBlock
        , height (px 60)
        , width (px 60)
        , margin (px 20)
        ]


trafficLight =
    div []
        [ light red [] []
        , light yellow [] []
        , light green [] []
        ]


main =
    trafficLight
Screenshot of the above code ran in a browser πŸ’…

Animations

CSS animations with @keyframes aren't scoped to a single function but you still don't want them to be global. This is why we export a keyframes helper which will generate a unique name for your keyframes. You can then use that unique name throughout your app.

import Html exposing (..)
import Styled exposing (..)
import Styled.Keyframes exposing (keyframes)
import Styled.Transforms exposing (rotate)
import Styled.Timings exposing (linear)


spin =
    keyframes
        [ ( 0
          , [ transform (rotate (deg 0))
            ]
          )
        , ( 100
          , [ transform (rotate (deg 360))
            ]
          )
        ]


loader =
    styled div
        [ display inlineBlock
        , animationName spin
        , animationDuration (Styled.s 2)
        , animationTimingFunction linear
        , animationIterationCount infinite
        ]


main =
    loader [] [ text "[ πŸ’… ]" ]
Screenshot of the above code ran in a browser πŸ’…
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].