DisclosureGroup
여러 Disclosure 항목을 조정된 확장 상태로 관리하는 컨테이너예요.
본문
사용법 (Usage)
import { DisclosureGroup } from '@heroui/react';
{
"name": "disclosure-group-basic",
"minHeight": "580px"
}
구조 (Anatomy)
import {DisclosureGroup, Disclosure} from '@heroui/react';
export default () => (
<DisclosureGroup>
<Disclosure id="item1">
<Disclosure.Heading>
<Disclosure.Trigger>
<Disclosure.Indicator />
</Disclosure.Trigger>
</Disclosure.Heading>
<Disclosure.Content />
</Disclosure>
</DisclosureGroup>
)
예시 (Examples)
제어 (Controlled)
expandedKeys와 onExpandedChange 프로퍼티를 사용해 외부 탐색 컨트롤로 어떤 disclosure가 확장되는지 제어할 수 있어요.
{
"name": "disclosure-group-controlled",
"minHeight": "580px"
}
커스터마이징 (Customization)
Tailwind CSS
{
"name": "disclosure-group-custom-styles"
}
Global CSS
DisclosureGroup 컴포넌트 클래스를 커스터마이징하려면 @layer components 지시어를 사용할 수 있어요.
더 알아보기.
@layer components {
.disclosure-group {
@apply w-full;
/* Performance optimization */
contain: layout style;
}
}
스타일 참조 (Styling Reference)
HeroUI는 컴포넌트 변형과 상태를 재사용하고 커스터마이징하기 쉽게 만들기 위해 BEM 방법론을 따르고 있어요.
CSS 클래스 (CSS Classes)
DisclosureGroup 컴포넌트는 다음 CSS 클래스를 사용해요 (소스 스타일 보기):
기본 클래스 (Base Classes)
.disclosure-group- 레이아웃 containment가 있는 기본 컨테이너 스타일
상호작용 상태 (Interactive States)
컴포넌트는 유연성을 위해 CSS 가상 클래스와 데이터 속성을 모두 지원해요:
- 비활성화 (Disabled): 전체 그룹의
:disabled또는[aria-disabled="true"] - 확장 관리 (Expanded Management): 자식 Disclosure 항목의
[data-expanded]상태를 자동으로 관리
API 참조 (API Reference)
DisclosureGroup
| Prop | Type | Default | Description |
|---|---|---|---|
expandedKeys |
Set<Key> |
- | 현재 확장된 항목 (제어) |
defaultExpandedKeys |
Iterable<Key> |
- | 초기에 확장된 항목 (비제어) |
onExpandedChange |
(keys: Set<Key>) => void |
- | 확장된 항목이 변경될 때 호출되는 핸들러 |
allowsMultipleExpanded |
boolean |
false |
여러 항목을 동시에 확장할 수 있는지 여부 |
isDisabled |
boolean |
false |
그룹의 모든 disclosure가 비활성화되었는지 여부 |
children |
ReactNode | RenderFunction |
- | 렌더링할 Disclosure 항목 |
className |
string |
- | 추가 CSS 클래스 |
렌더 프로퍼티 (Render Props)
렌더 프로퍼티 패턴을 사용하면 다음 값이 제공돼요:
| Prop | Type | Description |
|---|---|---|
expandedKeys |
Set<Key> |
현재 확장된 항목 키 |
isDisabled |
boolean |
그룹이 비활성화되었는지 여부 |