
Security News
Socket Integrates With Bun 1.3’s Security Scanner API
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
@chakra-ui/styled-system
Advanced tools
The framework's agnostic styling engine for Chakra UI. It's used in the system
package.
npm i @chakra-ui/styled-system
# or
yarn add @chakra-ui/styled-system
Chakra UI provides pretty good support for bidirectional (bidi
) CSS
properties. For our shorthand props, we provide a *Bidi
suffix to manage the
rtl/ltr switching.
import { css } from "@chakra-ui/styled-system"
const theme = {
direction: "rtl", // ltr | rtl
}
const styles = css({
mt: "40px",
// bi-directional `margin-right`
// `margin-right` in ltr, `margin-left` in rtl
mrBidi: "30px",
})(theme)
const cssLogicalValueMap = {
float: { left: "inline-start", right: "inline-end" },
clear: { left: "inline-start", right: "inline-end" },
resize: { horizontal: "block", vertical: "inline" },
textAlign: { left: "start", right: "end" },
captionSize: { top: "block-start", bottom: "block-end" },
}
const cssLogicalPropertiesMap = {
// Margin and Padding Logical Properties
"marginTop|mt": "marginBlockStart",
"marginLeft|ml": "marginInlineStart",
"marginRight|mr": "marginInlineEnd",
"marginBottom|mb": "marginBlockEnd",
"paddingTop|pt": "paddingBlockStart",
"paddingBottom|pb": "paddingBlockEnd",
"paddingLeft|pl": "paddingInlineStart",
"paddingRight|pr": "paddingInlineEnd",
"marginY|my": "marginBlock",
"marginX|mx": "marginInline",
"paddingY|py": "paddingBlock",
"paddingX|px": "paddingInline",
// Floating and positioning logical properties
top: "insetBlockStart",
bottom: "insetBlockEnd",
left: "insetInlineStart",
right: "insetInlineEnd",
// Sizing Logical properties
"width|w": "inlineSize",
"minW|minWidth": "minInlineSize",
"maxW|maxWidth": "maxInlineSize",
"height|h": "blockSize",
"minH|minHeight": "minBlockSize",
"maxH|maxHeight": "maxBlockSize",
// Border logical properties
borderY: "borderBlock",
borderX: "borderInline",
borderTop: "borderBlockStart",
borderTopWidth: "borderBlockStartWidth",
borderTopStyle: "borderBlockStartStyle",
borderTopColor: "borderBlockStartColor",
borderBottom: "borderBlockEnd",
borderBottomWidth: "borderBlockEndWidth",
borderBottomStyle: "borderBlockEndStyle",
borderBottomColor: "borderBlockEndColor",
borderLeft: "borderInlineStart",
borderLeftWidth: "borderInlineStartWidth",
borderLeftStyle: "borderInlineStartStyle",
borderLeftColor: "borderInlineStartColor",
borderRight: "borderInlineEnd",
borderRightWidth: "borderInlineEndWidth",
borderRightStyle: "borderInlineEndStyle",
borderRightColor: "borderInlineEndColor",
}
styled-components is a popular CSS-in-JS library that allows you to write plain CSS in your JavaScript. It provides a way to style your components using tagged template literals. Unlike @chakra-ui/styled-system, it does not come with a built-in theme system but allows you to create your own.
Emotion is another CSS-in-JS library that offers both string and object styles. It provides a powerful and flexible way to style your components. Emotion has a similar approach to @chakra-ui/styled-system but offers more flexibility in terms of styling methods.
Tailwind CSS is a utility-first CSS framework that provides low-level utility classes to build custom designs. Unlike @chakra-ui/styled-system, which is a CSS-in-JS solution, Tailwind CSS is a traditional CSS framework that you can use with any front-end library or framework.
FAQs
Style function for css-in-js building component libraries
The npm package @chakra-ui/styled-system receives a total of 671,215 weekly downloads. As such, @chakra-ui/styled-system popularity was classified as popular.
We found that @chakra-ui/styled-system demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Security News
Python 3.14 adds template strings, deferred annotations, and subinterpreters, plus free-threaded mode, an experimental JIT, and Sigstore verification.
Security News
Former RubyGems maintainers have launched The Gem Cooperative, a new community-run project aimed at rebuilding open governance in the Ruby ecosystem.