@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
39 lines (38 loc) • 1.27 kB
TypeScript
/**
* Copyright IBM Corp. 2016, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import { LayerLevel } from './LayerLevel';
import { PolymorphicProps } from '../../types/common';
/**
* A custom hook that will return information about the current layer. A common
* field to pull from this is the `level` for the layer that the component that
* calls this hook is currently in
*/
export declare function useLayer(): {
level: 0 | 1 | 2;
};
interface LayerBaseProps {
/**
* Provide child elements to be rendered inside of `Theme`
*/
children?: React.ReactNode;
/**
* Provide a custom class name to be used on the outermost element rendered by
* the component
*/
className?: string;
/**
* Specify the layer level and override any existing levels based on hierarchy
*/
level?: LayerLevel;
}
export type LayerProps<T extends React.ElementType> = PolymorphicProps<T, LayerBaseProps>;
export interface LayerComponent {
<T extends React.ElementType>(props: LayerProps<T>, context?: any): React.ReactElement<any, any> | null;
}
export declare const Layer: LayerComponent;
export {};