1.11.0 • Published 12 months ago

@s-ui/react-behavior-sticky v1.11.0

Weekly downloads
65
License
MIT
Repository
-
Last release
12 months ago

BehaviorSticky

This component helps in the implementation of sticky components

Installation

$ npm install @s-ui/react-behavior-sticky --save

Usage

import BehaviorSticky, {BehaviorStickyProvider} from '@s-ui/react-behavior-sticky'

Basic usage (Fixed at top)

<BehaviorStickyProvider>
  ...
  <BehaviorSticky>
    <HeaderFixed />
  </BehaviorSticky>
  ...
</BehaviorStickyProvider>

Sticky state

<BehaviorStickyProvider>
  ...
  <BehaviorSticky>{({isSticky}) => <HeaderFixed variant={isSticky ? 'sticky' : 'default'} />}</BehaviorSticky>
  ...
</BehaviorStickyProvider>

Sticky per container

<BehaviorStickyProvider>
  ...
  <div ref={container1}>
    <BehaviorSticky container={container1} defaultOffsetTop={45} animate>
      <HeaderWithButtons className={CLASS_DEMO_FIXED_BUTTONS} />
    </BehaviorSticky>
    <Content className={CLASS_DEMO_CONTENT} />
  </div>
  ...
</BehaviorStickyProvider>

Find full description and more examples in the demo page.

1.11.0

12 months ago

1.10.0

1 year ago

1.9.0

3 years ago

1.8.0

3 years ago

1.7.0

3 years ago

1.6.0

3 years ago

1.5.0

4 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

6 years ago