@class101/styled-system__variant

中文文档
5.3.3发布于 2021/11/01MITESM + CJS近 30 天下载 4085
原始使用文档

@class101/styled-system__variant

Read the docs: https://styled-system.com/variants

Usage

import styled from 'styled-components'
import variant from '@class101/styled-system__variant'

const Button = styled('button')(
  variant({
    variants: {
      primary: {
        color: 'white',
        bg: 'primary',
        ':hover': {
          bg: 'black',
        }
      },
      secondary: {
        color: 'white',
        bg: 'secondary',
        ':hover': {
          bg: 'black',
        }
      },
    }
  })
)

// <Button variant='primary' />
// <Button variant='secondary' />

Options

  • variants: object of theme-aware variant styles with user-defined shape
  • prop: (default variant) custom prop name for variant
  • scale: optional theme key for adding variants to the theme object

MIT License

版本与发布记录

@class101/styled-system__variant 共发布 3 个版本,首次发布于 2021/09/15;过去 12 个月发布了 0 个版本。

版本发布日期距今
5.3.3latest2021/11/015 年前
5.3.22021/11/015 年前
5.3.12021/09/155 年前

关于 @class101/styled-system__variant 的常见问题

@class101/styled-system__variant 是什么?

Read the docs: https://styled-system.com/variants

如何安装 @class101/styled-system__variant?

在项目目录运行 npm install @class101/styled-system__variant,或使用 pnpm add / yarn add / bun add。

@class101/styled-system__variant 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/class101__styled-system__variant 是否存在。

@class101/styled-system__variant 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@class101/styled-system__variant 可以商用吗?

@class101/styled-system__variant 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@class101/styled-system__variant 的下载量有多少?

根据 npm 官方下载统计,@class101/styled-system__variant 在 2026/10/10 – 2026/11/08 这 30 天内被下载 4,085 次,日均约 136 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@class101/styled-system__variant 还在维护吗?

最新版本 5.3.3 发布于 2021/11/01(5 年前);至今共发布 3 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/09/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。