···6677## Component Creation Process
8899-To create a new hip component follow these steps:
1010-1111-1. **Research phase**: First ask if there is documentation for a headless component to look at (e.g., React Aria Components docs) Check https://component.gallery/ for similar implementation
1212-2. **Component implementation**: Create the component in `packages/hip-ui/src/components/[component-name]/index.tsx`
1313-3. **Config creation**: Create a config file `[component-name]-config.ts` in the same directory
1414-4. **Register config**: Import and add the config to `packages/hip-ui/src/cli/install.tsx` in the `COMPONENT_CONFIGS` array
1515-5. **Build**: Run the build command to compile the component
1616-6. **Install**: Run `pnpm hip install --all` in the apps/docs directory
1717-7. **Documentation**: Generate an `.mdx` page with examples in `apps/docs/src/docs/components/[component-name].mdx`
1818-8. **Examples**: Create example files in `apps/docs/src/examples/[component-name]/` directory
99+1. **Component implementation**: Create in `packages/hip-ui/src/components/[component-name]/index.tsx`
1010+2. **Config creation**: Create `[component-name]-config.ts` with all dependencies
1111+3. **Register config**: Add to `packages/hip-ui/src/cli/install.tsx` COMPONENT_CONFIGS array
1212+4. **Documentation**: Create `.mdx` in `apps/docs/src/docs/components/[category]/[component-name].mdx`
1313+5. **Examples**: Create examples in `apps/docs/src/examples/[component-name]/`
19142015## Component Structure
2116···2924### Component File Structure
30253126```typescript
3232-"use client"; // Add this for client components that use React hooks or interactivity
2727+"use client"; // Required for React hooks, interactions, or react-aria-components
33283429import * as stylex from "@stylexjs/stylex";
3530import { ComponentFromAria } from "react-aria-components";
3636-// Import theme tokens and utilities
3737-import { ui, uiColor } from "../theme/semantic-color.stylex";
3131+import { breakpoints } from "../theme/media-queries.stylex"; // Use breakpoints, not mediaQueries
3232+import { ui } from "../theme/semantic-color.stylex";
3833import { spacing } from "../theme/spacing.stylex";
3939-import { radius } from "../theme/radius.stylex";
4040-import { shadow } from "../theme/shadow.stylex";
4141-import { fontFamily, fontSize, fontWeight } from "../theme/typography.stylex";
4242-import { animationDuration } from "../theme/animations.stylex";
4343-import { Size, StyleXComponentProps } from "../theme/types";
4444-// Import other hip components if needed
4545-import { Flex } from "../flex";
4646-import { Grid } from "../grid";
3434+import { StyleXComponentProps } from "../theme/types";
47354848-// Define styles using stylex.create
4936const styles = stylex.create({
5037 base: {
5151- // Use theme tokens, not hardcoded values
5238 padding: spacing["4"],
5353- borderRadius: radius["md"],
5454- backgroundColor: ui.bg,
5555- color: ui.text,
3939+ [breakpoints.sm]: { padding: spacing["6"] }, // Responsive styles
5640 },
5741});
58425959-// Export interface extending StyleXComponentProps
6060-export interface ComponentProps extends StyleXComponentProps<AriaComponentProps> {
6161- size?: Size;
6262- variant?: ComponentVariant;
6363-}
4343+export interface ComponentProps extends StyleXComponentProps<AriaComponentProps> {}
4444+4545+export const Component = ({ style, ...props }: ComponentProps) => {
4646+ return <AriaComponent {...stylex.props(styles.base, style)} {...props} />;
4747+};
4848+4949+// For composite components with subcomponents, export both individual and namespace:
5050+export const ComponentRoot = ({ style, ...props }: ComponentRootProps) => { /* ... */ };
5151+export const ComponentSection = ({ style, ...props }: ComponentSectionProps) => { /* ... */ };
64526565-// Export component
6666-export const Component = ({ style, size, variant, ...props }: ComponentProps) => {
6767- return (
6868- <AriaComponent
6969- {...stylex.props(styles.base, style)}
7070- data-size={size}
7171- {...props}
7272- />
7373- );
5353+export const Component = {
5454+ Root: ComponentRoot,
5555+ Section: ComponentSection,
7456};
7557```
7658···8365 name: "component-name",
8466 filepath: "./index.tsx",
8567 hipDependencies: [
8686- // List ALL theme files and other hip components used
6868+ // List ALL theme files used (only what's imported)
8769 "../theme/spacing.stylex.tsx",
8888- "../theme/radius.stylex.tsx",
8970 "../theme/semantic-color.stylex.tsx",
9090- "../theme/typography.stylex.tsx",
9191- "../theme/shadow.stylex.tsx",
9292- "../theme/animations.stylex.tsx",
7171+ "../theme/media-queries.stylex.tsx", // If using breakpoints
9372 "../theme/types.ts",
9494- // Other hip components if imported
9595- "../flex/index.tsx",
9673 ],
9774 dependencies: {
9898- // External npm packages required
9999- "react-aria-components": "^1.13.0",
7575+ "react-aria-components": "^1.13.0", // Only if used
10076 },
10177};
10278```
···1058110682### Styling
10783108108-- **Always use theme tokens** - Never hardcode colors, spacing, radius, shadows, or typography values
109109-- Use `semantic-color.stylex.tsx` for colors (`ui.*`, `uiColor.*`, `uiInverted.*`)
110110-- Use `spacing.stylex.tsx` for all spacing values
111111-- Use `radius.stylex.tsx` for border radius values
112112-- Use `shadow.stylex.tsx` for box shadows
113113-- Use `typography.stylex.tsx` for font styles
114114-- Use `animations.stylex.tsx` for transitions and animations
115115-- **Layout components**: Prefer `Flex` and `Grid` components over CSS for layout
116116-- **Size handling**: For composite components, use `SizeContext` to propagate size to child components. Only apply `size` prop to the root element
8484+- **Always use theme tokens** - Never hardcode values
8585+- Use `semantic-color.stylex.tsx` for colors (`ui.*`, `uiColor.*`)
8686+- Use `spacing.stylex.tsx`, `radius.stylex.tsx`, `typography.stylex.tsx`, etc. for all values
8787+- **Responsive styles**: Use `breakpoints` from `media-queries.stylex.tsx` (not `mediaQueries`)
8888+- Prefer `Flex` and `Grid` components over CSS for layout
8989+- Use `SizeContext` to propagate size to child components in composite components
1179011891### TypeScript
1199212093- Always extend `StyleXComponentProps<BaseProps>` for component props
12194- Use `stylex.StyleXStyles` for style props (never `className` or React `style`)
122122-- Export clear TypeScript interfaces with JSDoc comments for complex props
123123-- Use `data-*` attributes for conditional styling based on props (e.g., `data-size={size}`)
124124-125125-### React Aria Components
126126-127127-- When using React Aria Components, extend the appropriate Aria component props
128128-- Preserve accessibility features from React Aria Components
129129-- Use React Aria's built-in hooks and state management when appropriate
130130-- Follow React Aria Component patterns for composition (e.g., `DialogTrigger`, `Dialog`, `Modal`, `ModalOverlay`)
131131-132132-### Icons
133133-134134-- Use icons from `lucide-react` exclusively
135135-- Import icons as needed: `import { IconName } from "lucide-react";`
136136-- When used in a hip component the size does not need to be set
9595+- Export TypeScript interfaces with JSDoc comments for complex props
9696+- Use `data-*` attributes for conditional styling (e.g., `data-size={size}`)
1379713898### Component Composition
13999140140-- **Reuse existing components** - Prefer composing with existing hip components rather than redefining functionality
141141-- For composite components with multiple parts (e.g., Card, CardHeader, CardBody), export all related components from the same file
142142-- Use React Context (like `SizeContext`) for sharing props down the component tree when appropriate
100100+- For composite components (e.g., Footer, Card), export both:
101101+ 1. Individual components: `export const FooterRoot = ...`
102102+ 2. Namespace object: `export const Footer = { Root: FooterRoot, ... }`
103103+- This allows both `Footer.Root` and `FooterRoot` usage patterns
104104+- Export all related subcomponents from the same file
143105144144-### Client Components
106106+### React Aria & Icons
145107146146-- Add `"use client"` directive at the top of files that:
147147- - Use React hooks (`useState`, `useEffect`, etc.)
148148- - Handle user interactions
149149- - Use React Context
150150- - Import from `react-aria-components` (most components need this)
108108+- Extend appropriate Aria component props when using React Aria Components
109109+- Use icons from `lucide-react` exclusively (size handled automatically)
110110+- Add `"use client"` directive for hooks, interactions, or react-aria-components
151111152112## Documentation Structure
153113154154-### MDX File Template
114114+### MDX File
115115+116116+Place in `apps/docs/src/docs/components/[category]/[component-name].mdx` (e.g., `navigation/footer.mdx`)
155117156118```mdx
157119---
158120title: ComponentName
159159-description: Brief description of what the component does.
121121+description: Brief description.
160122---
161123162162-import { PropDocs } from "../../lib/PropDocs";
163163-import { Example } from "../../lib/Example";
164164-import { Basic } from "../../examples/component-name/basic";
165165-import { FeatureExample } from "../../examples/component-name/feature";
124124+import { PropDocs } from '../../../lib/PropDocs'
125125+import { Example } from '../../../lib/Example'
126126+import { Basic } from '../../../examples/component-name/basic'
166127167128<Example src={Basic} />
168129169130## Installation
170131171171-Run the following command to add the component to your project.
172172-173173-(Use triple backticks with bash language tag for the installation command)
132132+```bash
133133+pnpm hip install component-name
134134+```
174135175136## Props
176176-177177-This component is built using [React Aria ComponentName](link-to-docs).
178137179138<PropDocs components={["ComponentName", "SubComponent"]} />
180139···182141183142### Feature Name
184143185185-Description of the feature.
186186-187144<Example src={FeatureExample} />
188188-189189-## Related Components
190190-191191-- [RelatedComponent](/docs/components/related-component) - Description
192145```
193146194147### Example Files
195148196196-- Create example files in `apps/docs/src/examples/[component-name]/`
197197-- Start with `basic.tsx` showing the simplest usage
198198-- Create additional examples for each major feature (variants, sizes, states, etc.)
149149+- Create in `apps/docs/src/examples/[component-name]/`
150150+- Start with `basic.tsx` for simplest usage
199151- Use imports from `@/components/[component-name]`
200200-- Keep examples focused and minimal
152152+- Use StyleX styles (not inline styles) - import spacing/theme tokens as needed
201153202202-## Testing Checklist
154154+## Checklist
203155204204-Before considering a component complete:
205205-206206-- [ ] Component follows StyleX patterns with theme tokens
207207-- [ ] TypeScript interfaces are properly defined
208208-- [ ] All dependencies listed in config file
209209-- [ ] Config added to `install.tsx` COMPONENT_CONFIGS array
210210-- [ ] `"use client"` directive added if needed
211211-- [ ] Component works with `SizeContext` if size is supported
212212-- [ ] Basic example created
213213-- [ ] MDX documentation file created with proper structure
214214-- [ ] Related components listed in documentation
215215-- [ ] Component builds successfully
216216-- [ ] Component installs via `pnpm hip install`
156156+- [ ] Component uses theme tokens (no hardcoded values)
157157+- [ ] TypeScript interfaces with JSDoc comments
158158+- [ ] Config file lists all dependencies
159159+- [ ] Registered in `install.tsx` COMPONENT_CONFIGS
160160+- [ ] `"use client"` added if needed
161161+- [ ] Basic example and MDX docs created
162162+- [ ] Uses `breakpoints` (not `mediaQueries`) for responsive styles
163163+- [ ] Composite components export both individual and namespace patterns
···11+---
22+title: Footer
33+description: A flexible footer component for displaying site information, navigation links, and social media links.
44+---
55+66+import { PropDocs } from '../../../lib/PropDocs'
77+import { Example } from '../../../lib/Example'
88+import { Basic } from '../../../examples/footer/basic'
99+import { WithSocialLinks } from '../../../examples/footer/with-social-links'
1010+import { WithSections } from '../../../examples/footer/with-sections'
1111+import { Centered } from '../../../examples/footer/centered'
1212+import { WithSubscribeVertical } from '../../../examples/footer/with-subscribe-vertical'
1313+import { WithSubscribeHorizontal } from '../../../examples/footer/with-subscribe-horizontal'
1414+import { Comprehensive } from '../../../examples/footer/comprehensive'
1515+1616+<Example src={Comprehensive} noPadding />
1717+1818+## Installation
1919+2020+Run the following command to add the footer component to your project.
2121+2222+```bash
2323+pnpm hip install footer
2424+```
2525+2626+## Props
2727+2828+This is a custom component built for footer layouts.
2929+3030+<PropDocs components={["FooterRoot", "FooterSection", "FooterNavSection", "FooterNavGroup", "FooterCopyright", "FooterSocialLinkList", "FooterSocialLinkItem", "FooterSubscribe", "FooterSubscribeTitle", "FooterSubscribeDescription", "FooterSubscribeInput"]} />
3131+3232+## Features
3333+3434+### Minimal
3535+3636+A simple footer with just copyright information.
3737+3838+<Example src={Basic} noPadding />
3939+4040+### With Sections
4141+4242+Organize footer content into sections with optional titles.
4343+4444+<Example src={WithSections} noPadding />
4545+4646+### With Social Links
4747+4848+Add social media links with icons to your footer.
4949+5050+<Example src={WithSocialLinks} noPadding />
5151+5252+### Centered
5353+5454+Use the `isCentered` prop to center all footer content.
5555+5656+<Example src={Centered} noPadding />
5757+5858+### With Subscribe (Vertical)
5959+6060+Add a newsletter subscription form with vertical layout.
6161+6262+<Example src={WithSubscribeVertical} noPadding />
6363+6464+### With Subscribe (Horizontal)
6565+6666+Add a newsletter subscription form with horizontal layout.
6767+6868+<Example src={WithSubscribeHorizontal} noPadding />
6969+7070+## Related Components
7171+7272+- [Link](/docs/components/link) - For navigation links in footer sections
7373+- [Navbar](/docs/components/navbar) - For site navigation
7474+- [Grid](/docs/components/grid) - For multi-column footer layouts
7575+- [Flex](/docs/components/flex) - For flexible footer layouts