@carbon/react
Version:
React components for the Carbon Design System
67 lines (66 loc) • 2.24 kB
TypeScript
/**
* Copyright IBM Corp. 2016, 2025
*
* 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, { type HTMLAttributes } from 'react';
import { type ListBoxSize, type ListBoxType } from '.';
type ExcludedAttributes = 'onKeyDown' | 'onKeyPress' | 'ref';
export interface ListBoxProps extends Omit<HTMLAttributes<HTMLDivElement>, ExcludedAttributes> {
/**
* Specify whether the ListBox is currently disabled
*/
disabled?: boolean;
/**
* Specify whether the control is currently invalid
*/
invalid?: boolean;
/**
* Specify the text to be displayed when the control is invalid
*/
invalidText?: React.ReactNode;
/**
* Specify the id to be applied to the element containing the invalid text
*/
invalidTextId?: string;
/**
* Specify if the control should render open
*/
isOpen?: boolean;
/**
* `true` to use the light version. For use on $ui-01 backgrounds only.
* Don't use this to make tile background color same as container background color.
*
* @deprecated The `light` prop for `ListBox` has been deprecated in favor of
* the new `Layer` component. It will be removed in the next major release.
*/
light?: boolean;
/**
* Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
*/
size?: ListBoxSize;
/**
* Specify the "type" of the ListBox. Currently supports either `default` or
* `inline` as an option.
*/
type?: ListBoxType;
/**
* Specify whether the control is currently in warning state
*/
warn?: boolean;
/**
* Provide the text that is displayed when the control is in warning state
*/
warnText?: React.ReactNode;
/**
* Specify the id to be applied to the element containing the warn text
*/
warnTextId?: string;
}
/**
* `ListBox` is a generic container component that handles creating the
* container class name in response to certain props.
*/
declare const ListBox: React.ForwardRefExoticComponent<ListBoxProps & React.RefAttributes<HTMLDivElement>>;
export default ListBox;