Skip to main content

Layout Components

Layout helper components: Layout, FillAdapter.

Layout

Flex layout container component, provides flexible layout capabilities.

Basic Usage

import {PilotKit, Layout, ConversationList, ControlPanel} from '@bdky/aaas-pilot-kit-react-widget';
import '@bdky/aaas-pilot-kit-react-widget/styles.css';

function App() {
return (
<PilotKit {...props}>
<Layout direction="vertical" hCenter>
<ConversationList />
<ControlPanel />
</Layout>
</PilotKit>
);
}

Vertical Center Layout

<Layout direction="vertical" vCenter hCenter>
<div>Vertically and horizontally centered content</div>
</Layout>

Horizontal Layout

<Layout direction="horizontal" vCenter>
<div>Left content</div>
<FillAdapter />
<div>Right content</div>
</Layout>

Props

PropertyTypeDefaultDescription
direction'horizontal' | 'vertical''horizontal'Layout direction
fill'full' | 'auto''full'Fill mode
vCenterbooleanfalseVertical center
hCenterbooleanfalseHorizontal center
classNamestring-Custom class name
styleCSSProperties-Custom style

fill Property Description

ValueDescription
'full'Fill parent container (width: 100%, height: 100%)
'auto'Size determined by content

Style Customization

Class NameDescription
.apk-layoutRoot container
.apk-layout--horizontalHorizontal layout
.apk-layout--verticalVertical layout
.apk-layout--v-centerVertical center
.apk-layout--h-centerHorizontal center
.apk-layout-fill--fullFull fill mode
.apk-layout-fill--autoAuto size mode

FillAdapter

Adaptive fill component, works with Layout to occupy remaining space.

Basic Usage

import {Layout, FillAdapter, ControlPanel} from '@bdky/aaas-pilot-kit-react-widget';
import '@bdky/aaas-pilot-kit-react-widget/styles.css';

function App() {
return (
<Layout direction="vertical">
<FillAdapter /> {/* Occupy remaining space above */}
<ControlPanel /> {/* Fixed at bottom */}
</Layout>
);
}

Multiple FillAdapter

You can use multiple FillAdapter components with different flex values:

<Layout direction="vertical">
<FillAdapter flex={1} /> {/* Occupy 1 part */}
<div>Middle content</div>
<FillAdapter flex={2} /> {/* Occupy 2 parts */}
</Layout>

Props

PropertyTypeDefaultDescription
flexnumber1Flex growth factor
classNamestring-Custom class name
styleCSSProperties-Custom style

Adaptive Direction

FillAdapter automatically detects the parent Layout direction:

  • Vertical layout: Occupy vertical space (minHeight: 0)
  • Horizontal layout: Occupy horizontal space (minWidth: 0)

Using Context

FillAdapter uses the useLayout Hook to get the parent Layout direction:

import {useLayout} from '@bdky/aaas-pilot-kit-react-widget';
import '@bdky/aaas-pilot-kit-react-widget/styles.css';

function CustomFiller() {
const {direction} = useLayout();

return (
<div style={{
flex: 1,
...(direction === 'vertical'
? {minHeight: 0}
: {minWidth: 0})
}} />
);
}

Style Customization

Class NameDescription
.apk-fill-adapterRoot container

Typical Layout Examples

Digital Employee Standard Layout

<PilotKit {...props}>
<Layout direction="vertical" hCenter>
{/* Top: Occupy remaining space, digital human avatar displays here */}
<FillAdapter />

{/* Middle: Conversation list */}
<ConversationList />

{/* Middle: Recommended questions */}
<RecommendedQuestions
questions={['Question 1', 'Question 2']}
style={{marginBottom: 10}}
/>

{/* Bottom: Subtitle */}
<Subtitle style={{marginBottom: 10}} />

{/* Bottom: Control panel */}
<ControlPanel style={{marginBottom: 30}} />
</Layout>
</PilotKit>

Mobile Adaptation Layout

const isMobile = useIsMobile();

<PilotKit {...props}>
<Layout direction="vertical" hCenter>
<FillAdapter />

{/* Show conversation list on mobile, show subtitle on PC */}
{isMobile ? (
<ConversationList />
) : (
<Subtitle expandable onExpand={handleExpand} />
)}

<ControlPanel />
</Layout>
</PilotKit>