@ark-ui/react
Version:
A collection of unstyled, accessible UI components for React, utilizing state machines for seamless interaction.
37 lines (36 loc) • 1.01 kB
TypeScript
import { RenderStrategyProps } from '../../utils/render-strategy';
import { HTMLProps } from '../factory';
import { UsePresenceReturn } from '../presence/use-presence';
export interface UseSwapProps extends RenderStrategyProps {
/**
* Whether the swap is in the "on" state.
* @default false
*/
swap?: boolean;
}
export interface IndicatorProps {
type: 'on' | 'off';
}
export interface UseSwapReturn {
/**
* Whether the swap is in the "on" state.
*/
swap: boolean;
/**
* The presence instance for the "on" indicator.
*/
onPresence: UsePresenceReturn;
/**
* The presence instance for the "off" indicator.
*/
offPresence: UsePresenceReturn;
/**
* Props for the root element.
*/
getRootProps: () => HTMLProps<'span'>;
/**
* Props for the indicator element.
*/
getIndicatorProps: (props: IndicatorProps) => HTMLProps<'span'>;
}
export declare const useSwap: (props?: UseSwapProps) => UseSwapReturn;