UNPKG

@hakit/components

Version:
42 lines 2.83 kB
import { ReactNode } from 'react'; import { HassEntityWithService, ExtractDomain, EntityName } from '@hakit/core'; import { IconProps } from '@iconify/react'; import { CardBaseProps } from '../..'; type OmitProperties = "as" | "children" | "ref" | "description"; export interface ButtonCardProps<E extends EntityName> extends Omit<CardBaseProps<"button", E>, OmitProperties> { /** Optional icon param, this is automatically retrieved by the "domain" name if provided, or can be overwritten with a custom value, provide a string with the name of the icon, or a custom icon by providing a react node */ icon?: ReactNode | null; /** the props for the icon, which includes styles for the icon */ iconProps?: Omit<IconProps, "icon">; /** the props to provide to the Fab element within the card, useful if you want to re-style it */ fabProps?: React.ComponentProps<"div">; /** By default, the title is retrieved from the friendly name of the entity, or you can specify a manual title */ title?: ReactNode | null; /** The description will naturally fall under the title, by default it will show the information of the entity like the state */ description?: ReactNode | null; /** The layout of the button card, mimics the style of HA mushroom cards in slim/slim-vertical @default "default" */ layoutType?: "default" | "slim" | "slim-vertical"; /** custom method to render the state however you choose, this will just change how the "suffix" of the title will appear */ customRenderState?: (entity: HassEntityWithService<ExtractDomain<E>>) => ReactNode; /** hide the icon shown in the component @default false */ hideIcon?: boolean; /** Hide the state value @default false */ hideState?: boolean; /** Hide the last updated time @default false */ hideLastUpdated?: boolean; /** This forces hideState, hideLastUpdated and will only show the entity name / description prop @default false */ hideDetails?: boolean; /** Will hide the "toggle" element shown in the default layout @default false */ hideToggle?: boolean; /** The children to render at the bottom of the card */ children?: React.ReactNode; /** Separator rendered between description and state when both exist. Can be any React node. @default '-' */ descriptionSeparator?: React.ReactNode; } /** * The ButtonCard component is an easy way to represent the state and control of an entity with a simple button, eventually I'll provide further options per domain, like being able to set the colours for lights etc... * Below are a few examples of layouts that the ButtonCard supports * */ export declare function ButtonCard<E extends EntityName>(props: ButtonCardProps<E>): import("@emotion/react/jsx-runtime").JSX.Element; export {}; //# sourceMappingURL=index.d.ts.map