Docs
/
actions

Actions

A stack of handy functions you could write yourself, but don't want to.

scrollToTop

Link Copied!

Scrolls to the top of the page

scrollToTop()

scrollToBottom

Link Copied!

Scrolls to the bottom of the page

scrollToBottom()

scrollToAnchor

Link Copied!

Smoothly scrolls to the element with the specified ID without scuffing up your URLs.

scrollToAnchor('jagger')
scrollToAnchor(id: string)

toggleBodyScroll

Link Copied!

Toggles the body scroll with specified class names and returns a promise

toggleBodyScroll('fixed', action: 'toggle')
Use your own class names, or ensure fixed is within your Tailwindcss JIT
toggleBodyScroll(className: string = 'fixed', action: 'add' | 'remove' | 'toggle' = 'toggle')

toggleElementScroll

Link Copied!

Toggles the element scroll with specified class names and returns a promise

Deep in my heart, there's a fire, a burnin' heart

Deep in my heart, there's desire for a start

I'm dying in emotion

It's my world in fantasy

I'm livin' in my, livin' in my dreams


You're my heart, you're my soul

I keep it shining everywhere I go

You're my heart, you're my soul

I'll be holding you forever

Stay with you together


You're my heart, you're my soul

Yeah, a feelin' that our love will grow

You're my heart, you're my soul

That is the only thing I really know


Let's close the door and believe my burnin' heart

Feeling all right come on, open up your heart

I'll keep the candles burning

Let your body melt in mine

I'm livin' in my, livin' in my dreams


You're my heart, you're my soul

I keep it shining everywhere I go

You're my heart, you're my soul

I'll be holding you forever

Stay with you together


You're my heart, you're my soul

Yeah, a feelin' that our love will grow

You're my heart, you're my soul

That is the only thing I really know


You're my heart, you're my soul

Yeah, a feelin' that our love will grow

You're my heart, you're my soul

That is the only thing I really know


You're my heart, you're my soul

Yeah, a feelin' that our love will grow


toggleElementScroll(element: HTMLElement)

toggleFullScreen

Link Copied!

Copies a convereted string to the clipboard

toggleFullScreen()

resetForm

Link Copied!

Resets a form to its initial state

resetForm(form: HTMLFormElement)

focusOnInvalid

Link Copied!

Focuses on and scrolls to the first invalid input, select, or textarea element within a form.

focusOnInvalid(container: HTMLElement)

focusOnNth

Link Copied!

Focuses on the nth element within the specified form, where 0 is the first element and -1 is the last element.

focusOnNth(container: HTMLElement, index: number = 0)

focusTrap

Link Copied!

Sets up a keyboard trap within an HTML element, allowing the focus to cycle between the first and last focusable elements when the Tab key is pressed.

focusTrap(container: HTMLElement)