import React from 'react'; import IconButton from '@mui/material/IconButton'; import type { IconButtonProps } from '@mui/material/IconButton'; import Tooltip from '@mui/material/Tooltip'; import type { MRT_TableInstance } from '..'; interface Props = {}> extends IconButtonProps { table: MRT_TableInstance; } export const MRT_ToggleDensePaddingButton = < TData extends Record = {}, >({ table, ...rest }: Props) => { const { getState, options: { icons: { DensityLargeIcon, DensityMediumIcon, DensitySmallIcon }, localization, }, setDensity, } = table; const { density } = getState(); const handleToggleDensePadding = () => { const nextDensity = density === 'comfortable' ? 'compact' : density === 'compact' ? 'spacious' : 'comfortable'; setDensity(nextDensity); }; return ( {density === 'compact' ? ( ) : density === 'comfortable' ? ( ) : ( )} ); };