mui-component
Version:
some custom mui components
55 lines (54 loc) • 2.79 kB
TypeScript
import React from "react";
import { type SxProps } from "@mui/material";
import type { ExtendButtonTypeMap, ButtonClasses } from "@mui/material/Button";
import type { OverrideProps } from "@mui/material/OverridableComponent";
import type { Theme } from "@mui/material/styles";
export declare const LoadingButton: React.ForwardRefExoticComponent<Omit<LoadingButtonProps<"button", {}>, "ref"> & React.RefAttributes<unknown>>;
export type LoadingButtonTypeMap<P = {}, D extends React.ElementType = "button"> = ExtendButtonTypeMap<{
props: P & {
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<ButtonClasses> & {
/** Styles applied to the root element. */
root?: string;
/** Styles applied to the root element if `loading={true}`. */
loading?: string;
/** Styles applied to the loadingIndicator element. */
loadingIndicator?: string;
/** Styles applied to the loadingIndicator element if `loadingPosition="center"`. */
loadingIndicatorCenter?: string;
/** Styles applied to the loadingIndicator element if `loadingPosition="start"`. */
loadingIndicatorStart?: string;
/** Styles applied to the loadingIndicator element if `loadingPosition="end"`. */
loadingIndicatorEnd?: string;
/** Styles applied to the endIcon element if `loading={true}` and `loadingPosition="end"`. */
endIconLoadingEnd?: string;
/** Styles applied to the startIcon element if `loading={true}` and `loadingPosition="start"`. */
startIconLoadingStart?: string;
};
/**
* If `true`, the loading indicator is shown.
* @default false
*/
loading?: boolean;
/**
* Element placed before the children if the button is in loading state.
* The node should contain an element with `role="progressbar"` with an accessible name.
* By default we render a `CircularProgress` that is labelled by the button itself.
* @default <CircularProgress color="inherit" size={16} />
*/
loadingIndicator?: React.ReactNode;
/**
* The loading indicator can be positioned on the start, end, or the center of the button.
* @default 'center'
*/
loadingPosition?: "start" | "end" | "center";
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme>;
};
defaultComponent: D;
}>;
export type LoadingButtonProps<D extends React.ElementType = LoadingButtonTypeMap["defaultComponent"], P = {}> = OverrideProps<LoadingButtonTypeMap<P, D>, D>;