Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uiw/react-affix

Package Overview
Dependencies
Maintainers
2
Versions
171
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uiw/react-affix

Affix component

  • 4.22.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
404
increased by24.69%
Maintainers
2
Weekly downloads
 
Created
Source

Affix 图钉

Buy me a coffee Open in unpkg NPM Downloads npm version

使用图钉,可以将内容固定在屏幕可视范围,并且不随页面的滚动而滚动,常用于菜单等。

import { Affix } from 'uiw';
// or
import Affix from '@uiw/react-affix';

基本用法

import React from 'react';
import { Affix, Button } from 'uiw';

export default function Demo() {
  return (
    <Affix offsetTop={60}>
      <Button type="primary">1 当按钮距离顶部距离为 0,按钮被钉在顶部</Button>
    </Affix>
  )
}

钉在底部

这个实例需要你缩小窗口高度,就可以测试看效果啦。

import React from 'react';
import { Affix, Button } from 'uiw';

export default function Demo() {
  return (
    <Affix offsetBottom={10} onChange={(affixed) => {
      console.log('affixed::', affixed);
    }}>
      <Button type="primary" style={{ marginLeft: 20 }}>2 当按钮距离底部距离为 0,按钮被钉在底部</Button>
    </Affix>
  )
}

Props

参数说明类型默认值
offsetBottom距离窗口底部达到指定偏移量后触发Number-
offsetTop距离窗口顶部达到指定偏移量后触发Number-
onChange固定状态改变时触发的回调函数Function(affixed)-

Keywords

FAQs

Package last updated on 29 Nov 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc