0.0.14 • Published 12 months ago

@oak-digital/react-peek-a-header v0.0.14

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

React wrapper for Peek a header

This library provides a context and components for using @oak-digital/peek-a-header.

It provides a hiding header which hides and shows as the user scrolls. It is configurable so you can use your own animations based on the events fired by peek-a-header.

Getting started

Installation

Install with your package manager

$ npm i @oak-digital/react-peek-a-header
$ pnpm i @oak-digital/react-peek-a-header
$ yarn add @oak-digital/react-peek-a-header

Usage

Quickstart example

import { PeekAHeaderComponent } from '@oak-digital/react-peek-a-header'

const MyHeader = () => {
    return (
        <PeekAHeaderComponent>
            Here is my header
        </PeekAHeaderComponent>
    )
}

export default MyHeader

This header is very simple and will hide and show when the user scrolls

Props

You can pass the same props to this as an HTMLElement and the same props as in PeekAHeaderOptions.

Please check peek-a-header docs for more information.

events props

You should use the events props to listen for events, it is just an event map.

Example:

<PeekAHeaderComponent events={{
    progress: (progress) => {
        // Do something with progress
    },
}}>
    ...
</PeekAHeaderComponent>

tag prop

You may not always want to use a <header> element for the hiding header. maybe because it is already wrapped in a <header> tag.

You can easily change it by using the tag prop, just pass a string of which tag you would like.

example:

<PeekAHeaderComponent tag="div">
    ...
</PeekAHeaderComponent>
0.0.14

12 months ago

0.0.13

12 months ago

0.0.12

12 months ago

0.0.11

12 months ago

0.0.10

12 months ago

0.0.9

12 months ago

0.0.8

12 months ago

0.0.7

12 months ago

0.0.6

12 months ago

0.0.5

12 months ago

0.0.4

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago