Tally UI
UI

IconButton

A square, icon-only button with variant and size options, built on React Native Pressable.

Import

import { IconButton } from '@tallyui/components';

Usage

import { IconButton, Icon } from '@tallyui/components';
import { Settings } from 'lucide-react-native';

<IconButton onPress={() => console.log('pressed')}>
  <Icon><Settings /></Icon>
</IconButton>

IconButton is a streamlined alternative to Button when you only need to display an icon with no label. It defaults to ghost variant and md size, keeping toolbars and action rows compact.

Variants

VariantClass
defaultbg-primary active:opacity-90
destructivebg-destructive active:opacity-90
outlineborder border-input bg-background active:bg-accent
secondarybg-secondary active:opacity-80
ghostactive:bg-accent

Sizes

SizeClass
smh-8 w-8
mdh-10 w-10
lgh-12 w-12

Props

PropTypeDefaultDescription
variant'default' | 'destructive' | 'outline' | 'secondary' | 'ghost''ghost'Visual style of the button
size'sm' | 'md' | 'lg''md'Controls the height and width of the square hit area
asChildbooleanfalseWhen true, renders as a Slot instead of Pressable, merging props onto the child element
disabledbooleanfalseDisables the button, applying opacity-50 and blocking pointer events on web
classNamestring-Additional NativeWind classes merged via cn()

Plus all React Native PressableProps (onPress, onLongPress, accessibilityLabel, etc.).

Differences from Button

ButtonIconButton
Default variantdefaultghost
Sizesdefault, sm, lg, iconsm, md, lg
TextClassContextYes -- cascades text/icon colorsNo
Typical children<Text> + optional <Icon><Icon> only

If you need text-color cascading inside an icon-only button, use <Button size="icon"> instead.

Examples

Toolbar row

import { IconButton, Icon, HStack } from '@tallyui/components';
import { Bold, Italic, Underline } from 'lucide-react-native';

<HStack className="gap-1">
  <IconButton>
    <Icon><Bold /></Icon>
  </IconButton>
  <IconButton>
    <Icon><Italic /></Icon>
  </IconButton>
  <IconButton>
    <Icon><Underline /></Icon>
  </IconButton>
</HStack>

Destructive action

import { Trash2 } from 'lucide-react-native';

<IconButton variant="destructive" accessibilityLabel="Delete item">
  <Icon><Trash2 /></Icon>
</IconButton>

Small outline

import { MoreHorizontal } from 'lucide-react-native';

<IconButton variant="outline" size="sm">
  <Icon size="sm"><MoreHorizontal /></Icon>
</IconButton>

Disabled state

<IconButton disabled accessibilityLabel="Locked">
  <Icon><Lock /></Icon>
</IconButton>

On this page