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

@sea-lion/react-inset

v0.3.0

Published

Inset 是一个容器组件,用于创建负边距效果,可以将内容向外延伸超出父元素的边界。

Downloads

12

Readme

react-inset

Inset 是一个容器组件,用于创建负边距效果,可以将内容向外延伸超出父元素的边界。

安装

$ yarn add @sea-lion/react-inset
# 或者
$ npm install @sea-lion/react-inset

基本使用

import { Inset } from "@sea-lion/react-inset";

export default () => (
  <div style={{ padding: "20px", border: "1px solid", borderRadius: "8px" }}>
    <Inset>
      <img
        src="/example-image.jpg"
        style={{ display: "block", width: "100%" }}
      />
    </Inset>
    <div style={{ padding: "20px" }}>
      <h3>带有 Inset 的卡片</h3>
      <p>Inset 组件使图片可以扩展到容器边缘,无需额外边距</p>
    </div>
  </div>
);

不同边的 Inset

Inset 组件可以应用于容器的不同边:

// 应用于顶部
<Inset side="top">
  <img src="/banner.jpg" />
</Inset>

// 应用于底部
<Inset side="bottom">
  <div className="footer-content" />
</Inset>

// 应用于左侧
<Inset side="left">
  <div className="sidebar" />
</Inset>

// 应用于右侧
<Inset side="right">
  <div className="right-panel" />
</Inset>

// 应用于水平方向
<Inset side="x">
  <div className="horizontal-content" />
</Inset>

// 应用于垂直方向
<Inset side="y">
  <div className="vertical-content" />
</Inset>

裁剪方式

Inset 支持不同的裁剪方式:

// 边框盒裁剪(默认)
<Inset clip="border-box">
  <img src="/image.jpg" />
</Inset>

// 内边距盒裁剪
<Inset clip="padding-box">
  <img src="/image.jpg" />
</Inset>

内边距控制

// 保持当前内边距
<Inset p="current">
  <div className="content" />
</Inset>

// 移除内边距
<Inset p="0">
  <div className="content" />
</Inset>

// 控制特定方向的内边距
<Inset px="0" py="current">
  <div className="content" />
</Inset>

属性

Inset

| 参数 | 说明 | 类型 | 默认值 | 版本 | | ---- | --------------- | ------------------------------------------------------------- | ------------ | ----- | | side | 应用 Inset 的边 | 'all' | 'x' | 'y' | 'top' | 'bottom' | 'left' | 'right' | 'all' | 0.2.0 | | clip | 裁剪盒模型 | 'border-box' | 'padding-box' | 'border-box' | 0.2.0 | | p | 所有方向内边距 | 'current' | '0' | - | 0.2.0 | | px | 水平方向内边距 | 'current' | '0' | - | 0.2.0 | | py | 垂直方向内边距 | 'current' | '0' | - | 0.2.0 | | pt | 顶部内边距 | 'current' | '0' | - | 0.2.0 | | pr | 右侧内边距 | 'current' | '0' | - | 0.2.0 | | pb | 底部内边距 | 'current' | '0' | - | 0.2.0 | | pl | 左侧内边距 | 'current' | '0' | - | 0.2.0 |

Inset 组件还支持所有标准的外边距属性(如 mmtmb 等)。 

查看更多

参考 Radix UI 官方文档 获取完整 API 与设计规范。