# Title: Component Structure
Description: Understanding the compound component pattern, asChild, polymorphism, and data attributes in Zayne UI
URL: /docs/component-structure
Source: https://raw.githubusercontent.com/zayne-labs/callapi/refs/heads/main/apps/docs/content/docs/component-structure.mdx
Zayne UI uses a **compound component pattern** — a single import gives you a namespace of sub-components that work together, sharing state through React context without prop drilling.
## Compound components [#compound-components]
Instead of one monolithic component with dozens of props, Zayne UI splits each component into composable parts. You pick the parts you need and arrange them however you want:
```tsx
import { DropZone } from "@zayne-labs/ui-react/ui/drop-zone";
Drag and drop files here
Select Files
{({ fileState }) => (
Remove
)}
;
```
Each sub-component is independently renderable. You can omit `DropZone.FileList` if you don't need file previews, or omit `DropZone.Trigger` if you only want drag-and-drop with no click-to-browse.
## Import patterns [#import-patterns]
Every component supports **two** import styles:
The namespace import gives you dot-notation access to all sub-components:
```tsx
import { DropZone } from "@zayne-labs/ui-react/ui/drop-zone";
import { Show } from "@zayne-labs/ui-react/common/show";
......
```
This is the recommended approach — it keeps component families visually grouped and makes it clear which parts belong together.
If you prefer, you can import each sub-component by its full name:
```tsx
import { DropZoneRoot, DropZoneTrigger, DropZoneArea } from "@zayne-labs/ui-react/ui/drop-zone";
import { ShowRoot, ShowContent, ShowFallback } from "@zayne-labs/ui-react/common/show";
Browse
```
## The `as` prop — polymorphism [#the-as-prop--polymorphism]
Most components accept an `as` prop that changes the underlying HTML element. TypeScript enforces that only valid attributes for the chosen element are allowed:
```tsx
import { Card } from "@zayne-labs/ui-react/ui/card";
// Default — renders Content;
// Renders with full anchor props
Clickable Card
;
// Renders
Stats
;
```
Each Card sub-component has its own default element:
| Sub-component | Default element | Accepts `as` |
| :----------------- | :-------------- | :----------- |
| `Card.Root` | `` | ✅ |
| `Card.Header` | `` | ✅ |
| `Card.Title` | `