npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@xuqiyong666/base-kit

v1.0.5

Published

React 布局基础组件库。通过 props 直接写样式和布局,无需手写 CSS 或 `style` 对象。

Readme

@xuqiyong666/base-kit

React 布局基础组件库。通过 props 直接写样式和布局,无需手写 CSS 或 style 对象。

import { HStack, Stack, Text } from '@xuqiyong666/base-kit'

<HStack gap={8} align="center">
  <Text>标签</Text>
  <Text color="#999">说明</Text>
</HStack>

安装

npm i @xuqiyong666/base-kit

需配合 reactreact-dom(>= 16.9.0)使用。

快速开始

import { Box, Heading, Stack, Text } from '@xuqiyong666/base-kit'

export function Page() {
  return (
    <Stack gap={16} p={24}>
      <Heading as="h2">页面标题</Heading>
      <Text>正文内容</Text>
      <Box p={16} bg="#fafafa" rounded={8}>
        内容区域
      </Box>
    </Stack>
  )
}

常见布局

全屏居中

import { Center, Heading, Stack, Text } from '@xuqiyong666/base-kit'

<Center h="100vh">
  <Stack gap={16} p={24} w={400} bg="#fff" rounded={8} shadow="0 4px 12px rgba(0,0,0,0.1)">
    <Heading as="h2">登录</Heading>
    <Text>请输入账号和密码</Text>
  </Stack>
</Center>

顶栏 + 内容区

import { Box, Heading, HStack, Text, VStack } from '@xuqiyong666/base-kit'

<VStack h="100vh">
  <HStack h={56} px={16} align="center" justify="space-between" borderBottom="1px solid #f0f0f0">
    <Heading as="h1" fontSize={18}>控制台</Heading>
    <Text>用户名</Text>
  </HStack>
  <Box flex={1} p={24}>主内容</Box>
</VStack>

左右分栏

import { Box, HStack } from '@xuqiyong666/base-kit'

<HStack gap={16} align="stretch">
  <Box flex={1} p={16} bg="#fafafa" rounded={8}>左侧内容</Box>
  <Box w={280} p={16} bg="#fafafa" rounded={8}>右侧面板</Box>
</HStack>

表单项纵向排列

import { Box, Stack, Text } from '@xuqiyong666/base-kit'

<Stack gap={16}>
  <Stack gap={8}>
    <Text>用户名</Text>
    <Box h={40} w="100%" bg="#fafafa" rounded={6} border="1px solid #d9d9d9" />
  </Stack>
  <Stack gap={8}>
    <Text>密码</Text>
    <Box h={40} w="100%" bg="#fafafa" rounded={6} border="1px solid #d9d9d9" />
  </Stack>
</Stack>

图标 + 文字横排

import { Box, HStack, Text } from '@xuqiyong666/base-kit'

<HStack gap={8} align="center">
  <Box w={8} h={8} bg="#1677ff" rounded="50%" />
  <Text>在线</Text>
</HStack>

卡片列表

import { Heading, Stack, Text } from '@xuqiyong666/base-kit'

<Stack gap={12}>
  {[1, 2, 3].map((item) => (
    <Stack
      key={item}
      gap={8}
      p={16}
      bg="#fff"
      rounded={8}
      border="1px solid #f0f0f0"
      _hover={{ borderColor: '#1677ff' }}
    >
      <Heading as="h3" fontSize={16}>卡片 {item}</Heading>
      <Text color="#666">卡片描述文字</Text>
    </Stack>
  ))}
</Stack>

组件速查

| 组件 | 用途 | 常用 props | |------|------|-----------| | Box | 万能容器,承载所有样式 | p px py m w h bg rounded | | Flex | 弹性布局 | gap align justify direction wrap | | Stack | 默认纵向排列 | gap | | HStack | 横向排列 | gap align justify | | VStack | 纵向排列 | gap align | | Center | 内容居中 | w h | | Text | 正文文字 | color fontSize | | Heading | 标题 | as="h1" ~ h6 fontSize fontWeight | | Code | 行内代码 | 默认等宽字体与内边距,可直接使用 |

所有组件均支持样式 props,可直接传 className 覆盖或补充样式。

样式 props 速查

所有组件共享同一套样式 props,支持标准 CSS 属性名和常用别名。

间距

| 别名 | 含义 | |------|------| | m mt mr mb ml mx my | margin | | p pt pr pb pl px py | padding |

尺寸

| 别名 | 含义 | |------|------| | w h minW maxW minH maxH | width / height |

颜色与背景

| 别名 | 含义 | |------|------| | textColor | 文字颜色 | | bg | background | | bgColor | backgroundColor |

圆角与边框

| 别名 | 含义 | |------|------| | rounded | borderRadius | | roundedTop roundedBottom roundedLeft roundedRight | 各边圆角 |

Flex

| 别名 | 含义 | |------|------| | align | alignItems | | justify | justifyContent | | direction flexDir | flexDirection | | spacing | gap |

交互状态

通过伪类 props 设置 hover、focus 等状态样式:

<Box
  p={12}
  border="1px solid #f0f0f0"
  _hover={{ borderColor: '#1677ff', color: '#1677ff' }}
>
  Hover me
</Box>

支持的伪类:_hover _active _focus _before _after _last

其他导出

  • @xuqiyong666/base-kit/hooksuseStateRef useShallowMemo useDeepEqualMemo
  • @xuqiyong666/base-kit/utilspatchByPath shallowEqual