App Bar
화면 상단에서 현재 화면의 제목과 탐색 액션을 보여주는 내비게이션 바 컴포넌트입니다.
Installation
의존성 설치
아래 코드를 복사 후 붙여넣고 사용하세요
Props
AppBar
Prop
Type
AppBarLeft
고유 prop이 없습니다. className, style, children, bindlayoutchange를 받습니다.
AppBarMain
Prop
Type
AppBarRight
고유 prop이 없습니다. className, style, children, bindlayoutchange를 받습니다.
AppBarSlot
고유 prop이 없습니다. className, style, children을 받습니다.
AppBarIconButton
Prop
Type
icon?ReactElement<LynxIconElementProps, string | JSXElementConstructor<any>> | undefinedAppBarTextButton
Prop
Type
AppBarBackButton
Prop
Type
icon?ReactElement<LynxIconElementProps, string | JSXElementConstructor<any>> | undefinedAppBarCloseButton
Prop
Type
icon?ReactElement<LynxIconElementProps, string | JSXElementConstructor<any>> | undefinedUsage
AppBarBackButton과 AppBarCloseButton에는 이동 동작이 없습니다. bindtap으로 앱의 탐색 함수를 연결하세요.
Title / Subtitle
AppBarMain에 subtitle을 전달하면 layout="withSubtitle"가 자동으로 적용됩니다.
Left / Right Action
왼쪽과 오른쪽에는 아이콘 버튼이나 직접 만든 슬롯을 배치할 수 있습니다. Cupertino theme에서는 좌우 슬롯 너비를 기준으로 제목이 가운데에 오도록 여백을 보정합니다.
각 슬롯의 가장자리 아이콘 버튼에만 보정이 적용됩니다. 직접 만든 레이아웃 박스 안의 버튼은 edge="leading", "trailing", "both" 중 하나를 지정하세요.
다른 아이콘을 쓰려면 AppBarIconButton의 icon prop에 Lynx 아이콘을 전달합니다.
Text Button
AppBarTextButton은 "완료", "닫기"처럼 짧은 텍스트로 동작을 표시합니다. Cupertino theme에서는 레이블이 최대 너비를 넘으면 말줄임표로 줄여 제목 영역을 확보합니다. 아이콘 버튼과 같이 슬롯 가장자리에 있으면 여백을 자동으로 보정하고, edge로 직접 지정할 수 있습니다.
Multiple / Conditional Actions
여러 버튼 중 가장자리에 있는 버튼만 여백을 보정합니다. 조건부 렌더링으로 버튼 수가 바뀌어도 제목은 가운데에 유지됩니다.
Custom Slot / Explicit Edge
직접 만든 레이아웃 박스나 AppBarSlot 안의 버튼에는 edge를 지정하세요. 일반적인 AppBarLeft와 AppBarRight의 직계 아이콘 버튼에는 필요하지 않습니다.
Tone
기본값인 tone="layer"는 레이어 배경을 표시합니다. tone="transparent"는 배경을 투명하게 하고 제목과 아이콘에 밝은 색상을 적용하므로 사진이나 어두운 배경 위에서 사용하세요. 배경과 스크롤에 따른 tone 전환은 호출부에서 관리합니다.
Accessibility
Lynx에서는 HTML ARIA 속성 대신 Lynx native 접근성 속성을 사용합니다. AppBarIconButton은 기본적으로 accessibility-element={true}와 accessibility-traits="button"을 적용하며, 아이콘만으로 의미를 알 수 없는 버튼에는 accessibility-label을 전달해야 합니다.
AppBarBackButton, AppBarCloseButton은 각각 "뒤로", "닫기" 레이블을 기본값으로 제공합니다. AppBarTextButton은 텍스트 children을 레이블로 사용하며, 다른 이름이 필요하면 accessibility-label로 지정합니다.
Theme
theme은 "cupertino"와 "android"를 지원합니다. 지정하지 않으면 플랫폼에 맞는 값을 사용합니다.
Web Version Differences
- 클릭 이벤트는
onClick대신bindtap으로 받습니다. - 아이콘 버튼의 접근성 이름은
aria-label대신accessibility-label로 지정합니다. theme과tone으로 플랫폼별 디자인과 배경을 지정합니다.- 뒤로 가기와 닫기 버튼에는 앱의 탐색 함수를 직접 연결해야 합니다.
Unsupported Lynx Features
- Stackflow activity와 자동으로 연동하지 않습니다.
- swipe-back 전환 애니메이션은 화면 탐색 계층에서 처리해야 합니다.
Last updated on