RRobloxUI
BrowseThemeSubmit
RRobloxUI β€” Roblox UI Components Marketplace
Theme ReferencePrivacy
Icon Button β€” RobloxUI
  1. Home
  2. /
  3. Buttons
  4. /
  5. Icon Button
Live Previewrunning real Luau in your browser
Booting Luau VM…
Preview of Icon Button β€” executed via in-browser Luau VM (wasmoon)

Icon Button

TSX + LuauFree

A compact button displaying only an icon. Ideal for toolbars, action bars, and inline controls where space is limited.

Details

AuthorRobloxUI Team
FrameworkRoblox-TS + React-Luau
CategoryButtons
Dependencies@rbxts/react, @robloxui/theme
Theme Tokenscolors.textSecondary
Last UpdatedJuly 22, 2026
import React from "@rbxts/react";
import { useTheme } from "@robloxui/theme";

interface IconButtonProps {
  icon: string;
  onClick: () => void;
  tooltip?: string;
  size?: number;
}

export function IconButton({ icon, onClick, tooltip, size = 24 }: IconButtonProps) {
  const { colors } = useTheme();

  return (
    <imagebutton
      Image={icon}
      BackgroundTransparency={1}
      Size={new UDim2(0, size + 16, 0, size + 16)}
      AutoButtonColor={true}
      Event={{ Activated: onClick }}
    >
      <imagelabel
        Image={icon}
        Size={new UDim2(0, size, 0, size)}
        Position={new UDim2(0.5, 0, 0.5, 0)}
        AnchorPoint={new Vector2(0.5, 0.5)}
        BackgroundTransparency={1}
        ImageColor3={colors.textSecondary}
      />
    </imagebutton>
  );
}