Skip to content

Releases: styled-components/xstyled

v3.0.0

24 May 08:20
2bdc5ff
Compare
Choose a tag to compare

xstyled v3 is focused on features.

Object states

States are now similar to breakpoints, they are specified using object syntax:

<x.button color={{ _: 'red-500', hover: 'red-300' }} />

They can be nested:

// Mixed screens and states
<x.button color={{ _: 'red-600', md: { _: 'red-500', hover: 'red-300' } }} />
// Nested states
<x.div bg={{ first: { odd: 'blue' } } } />

And they are configurable in theme:

export const theme = {
  states: {
    hover: '&:hover',
    // ...
  },
}

Learn more in states documentation.

Plugins API

xstyled can now be fully extended with plugins using a xstyled.config.js:

import { createCss, system, compose } from '@xstyled/...'
import { borderInline } from './utilities/border-inline'

export const { css, styled, x, createGlobalStyle } = createCss(
  compose(system, borderInline),
)

Learn more in documentation.

New text utility

A new text utility has been added. It is similar to fontSize excepts that it defines both font-size and line-height. It is customizabled to handle all your typography styles.

Learn more in text utility documentation.

New utilities

animationDuration, animationTimingFunction and maskSize have been added to the core.

Remove specificity

xstyled was using a trick to ensure props were more specific than component style. The props were injected in a &&, so the class was duplicated and the specificity increased. In v3, props are now injected in the correct order, it means this specificity is not longer required.

New multiple option in style

You can now use multiple to declare style that accepts multiple styles separated by a comma. For example, box-shadow:

<x.div boxShadow="light-shadow, big-shadow" />

Breaking changes

No prefixed states

States were prefixed props in v2. You can use this regular expression to find state props in your code:

((motionSafe|motionReduce|first|last|odd|even|visited|focusWithin|hover|focus|focusVisible|focusWithin|active|disabled|placeholder|checked)[A-Z])[A-Za-z]+=

Box has been removed

Box component is no longer available, you can safely replace it by x.div.

cssProperty option of style becomes css

Since the css accepts a mixin, cssProperty was no longer a good name.

getBreakpoints becomes getScreens and useBreakpoints becomes useScreens

In v1, theme section handling screens was named breakpoints, since v2 theme section is now screens. For consistency getBreakpoints becomes getScreens and useBreakpoints becomes useScreens.

th.timingFunctions becomes th.timingFunction

Every th.* utilities are singular, th.timingFunctions was a mistake.

x.extend and createX are gone

Use createCss instead.

TypeScript theme bindings

Be sure to correctly extend xstyled theme and to follow TypeScript guide.


Detail

Bug Fixes

Features

v3.0.0-beta.0

11 May 07:46
9ef8a37
Compare
Choose a tag to compare
v3.0.0-beta.0 Pre-release
Pre-release

Bug Fixes

Features

BREAKING CHANGES

  • Box has been removed, "cssProperty" has been renamed "css", "getBreakpoints" has been renamed "getScreens", "useBreakpoints" has been renamed "useScreens", "th.timingFunctions" has been renamed "th.timingFunction".
  • states: states are now passed in object.

v2.5.0

02 May 20:25
902e7a6
Compare
Choose a tag to compare

Bug Fixes

Features

v2.4.1

29 Mar 07:34
b5028a3
Compare
Choose a tag to compare

Bug Fixes

v2.4.0

28 Mar 17:36
100a013
Compare
Choose a tag to compare

Bug Fixes

Features

v2.3.0

23 Mar 06:44
a13b7c5
Compare
Choose a tag to compare

Bug Fixes

  • emotion: pass options through (#202) (781704c)
  • styled: use space in column-gap & row-gap (517c08e), closes #200
  • transform: confused by comments, whitespace (93cba6a)
  • types: add missing alignContent prop (eb3c47f), closes #205
  • types: invalid color prop (0660565)

Features

  • add float property (0335114), closes #192
  • add maxW, maxH, minW, minH shortcuts (fde802e), closes #199
  • durations: bind durations to theme.durations (362dea3)
  • transform: min/max widths in media queries (aa1f518)

Performance Improvements

  • add media query to benchmark (af10f5a)

v2.2.3

13 Feb 17:26
9cec90b
Compare
Choose a tag to compare

Bug Fixes

  • fix style merging problem (c6aa69c)

v2.2.2

03 Feb 06:36
bbdae21
Compare
Choose a tag to compare

Bug Fixes

  • fix & optimize style sorting (76ed20a)

Performance Improvements

v2.2.1

31 Jan 21:34
074f36f
Compare
Choose a tag to compare

Bug Fixes

v2.2.0

18 Jan 23:20
78bfb47
Compare
Choose a tag to compare

Bug Fixes

  • typings: fix massive type in createX (#173) (273e395)

Features

  • typings: type of colors object being more specific (#174) (379e54d)