Media slot
Exports
Import these components from @mbsw/ui.
MediaSlotProps
The tables list common props for each component. See the full types for supported prop combinations and inherited HTML and Radix props.
MediaSlot
| Prop | Type | Requirement |
|---|---|---|
aria-labelDefines a string value that labels the current element. | string | Required |
onClick | MouseEventHandler<HTMLButtonElement> | Optional |
shape | 'round' | 'square' | Optional |
size | 'lg' | 'md' | 'sm' | Optional |
children | ReactElement<unknown, string | JSXElementConstructor<any>> | Conditional |
disabled | boolean | Conditional |
errorMessage | string | Conditional |
state | "empty" | "filled" | "error" | "uploading" | Conditional |
uploadLabel | string | Conditional |
onRemove | MouseEventHandler<HTMLButtonElement> | Conditional |
removeLabel | string | Conditional |
Type reference
Show full types
Full TypeScript definitions, including prop combinations and inherited props.
TYPESCRIPT
import { type ButtonHTMLAttributes, type MouseEventHandler, type ReactElement } from 'react';
export type MediaSlotShape = 'round' | 'square';
export type MediaSlotSize = 'lg' | 'md' | 'sm';
export type MediaSlotState = 'empty' | 'error' | 'filled' | 'uploading';
type MediaSlotBaseProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'disabled' | 'onClick' | 'size' | 'type'> & {
'aria-label': string;
onClick?: MouseEventHandler<HTMLButtonElement>;
shape?: MediaSlotShape;
size?: MediaSlotSize;
};
type RemoveProps = {
onRemove: MouseEventHandler<HTMLButtonElement>;
removeLabel: string;
} | {
onRemove?: never;
removeLabel?: never;
};
export type MediaSlotProps = MediaSlotBaseProps & (({
children?: never;
disabled?: boolean;
errorMessage?: never;
state?: 'empty';
uploadLabel?: never;
} & {
onRemove?: never;
removeLabel?: never;
}) | ({
children: ReactElement;
disabled?: boolean;
errorMessage?: never;
state: 'filled';
uploadLabel?: never;
} & RemoveProps) | ({
children?: never;
disabled?: never;
errorMessage: string;
state: 'error';
uploadLabel?: never;
} & RemoveProps) | {
children?: never;
disabled?: never;
errorMessage?: never;
onRemove?: never;
removeLabel?: never;
state: 'uploading';
uploadLabel: string;
});
export declare const MediaSlot: import("react").ForwardRefExoticComponent<MediaSlotProps & import("react").RefAttributes<HTMLButtonElement>>;