ActionBar

free

ActionBar keeps bulk actions close to selected records without occupying the page at rest.

import { useState } from 'react';
import ActionBar from '@/components/ui/action-bar';
import Avatar from '@/components/ui/avatar';
import Button from '@/components/ui/button';

Installation

Add this component with the NateUI CLI.

npx nateui@latest add ActionBar

Examples

Basic

import { useState } from 'react';
import ActionBar from '@/components/ui/action-bar';
import Button from '@/components/ui/button';

Width

import { useState } from 'react';
import ActionBar from '@/components/ui/action-bar';
import Button from '@/components/ui/button';

Close With Escape

import { useState } from 'react';
import ActionBar from '@/components/ui/action-bar';
import Button from '@/components/ui/button';

Selection

import { useState } from 'react';
import ActionBar from '@/components/ui/action-bar';
import Button from '@/components/ui/button';
import Checkbox from '@/components/ui/checkbox';

API

ActionBar accepts the props below plus native props for the root div.

PropDescriptionTypeDefault
childrenContent rendered inside the action bar.ReactNode-
classNameClass names applied to the positioned action bar wrapper.string-
contentClassNameClass names applied to the inner action bar surface.string-
onOpenChangeCalled when the floating interaction layer requests an open-state change.ActionBarOpenChangeHandler-
openControls whether the action bar is visible.boolean-
refRef forwarded to the inner action bar content element.Ref<HTMLDivElement>-
shouldCloseOnEscAllows Escape to request closing through onOpenChange.booleanfalse
widthWidth of the action bar in pixels. Falls back to auto width when the viewport is narrower.number480
...nativePropsNative props for the positioned action bar wrapper.NativeActionBarProps-

Types

type ActionBarOpenChangeHandler = (open: boolean) => void;
 
type NativeActionBarProps = Omit<
  ComponentProps<'div'>,
  | 'children'
  | 'className'
  | 'contentClassName'
  | 'onOpenChange'
  | 'open'
  | 'ref'
  | 'shouldCloseOnEsc'
  | 'width'
>;