UNPKG

rmwc

Version:

A thin React wrapper for Material Design (Web) Components

65 lines (64 loc) 3.03 kB
import * as React from 'react'; import * as PropTypes from 'prop-types'; import { RMWCProviderOptionsT } from '../Provider'; export declare const IconRoot: { new <P>(props: any, context?: any): { render(): React.ReactElement<any> | null; setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: any) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; forceUpdate(callBack?: (() => void) | undefined): void; props: Readonly<{ children?: React.ReactNode; }> & Readonly<any>; state: Readonly<{}>; context: any; refs: { [key: string]: React.ReactInstance; }; }; displayName: string; defaultProps: { tag: string | React.ComponentClass<any> | React.StatelessComponent<any>; constructor: Function; toString(): string; toLocaleString(): string; valueOf(): Object; hasOwnProperty(v: string | number | symbol): boolean; isPrototypeOf(v: Object): boolean; propertyIsEnumerable(v: string | number | symbol): boolean; }; isSimpleTag: boolean; }; declare type IconStrategyT = 'auto' | 'ligature' | 'className' | 'url' | 'component' | 'custom'; export declare type IconPropsT = { /** The icon to use. This can be a string for a font icon, a url, or whatever the selected strategy needs. */ use?: React.ReactNode; /** The icon to use, specified as children instead of the "use" prop. */ children?: React.ReactNode; /** Handle multiple methods of embedding an icon. 'ligature' uses ligature style embedding like material-icons, 'className' adds a class onto the element for libraries like glyphicons and ion icons, 'url' will load a remote image, and 'component' will render content as children like SVGs or any other React node. 'custom' allows you to specify your own render prop. If not set, 'auto' will be used or the defaults set inside of RMWCProvider. */ strategy?: IconStrategyT; /** A className prefix to use when using css font icons that use prefixes, i.e. font-awesome-, ion-, glyphicons-. This only applies when using the 'className' strategy. */ prefix?: string; /** A base className for the icon namespace, i.e. material-icons. */ basename?: string; /** A render function to use when using the 'custom' strategy. */ render?: (content: any) => React.ReactNode; /** A custom className to add.. */ className?: string; }; /** * An Icon component. Most of these options can be set once globally, read the documentation on Provider for more info. */ export declare class Icon extends React.PureComponent<IconPropsT> { static displayName: string; static defaultProps: { use: undefined; }; static contextTypes: { RMWCOptions: PropTypes.Requireable<any>; }; componentWillMount(): void; providerOptions: RMWCProviderOptionsT; context: Object; render(): React.ReactNode; } export default Icon;