Component
A self-contained, reusable piece of UI that manages its own structure, styling, and behaviour.
A component is a building block of modern web interfaces. It encapsulates a piece of UI (a button, a card, a navigation bar, a form) along with its logic and styling into a single, reusable unit. Components accept data through props and manage internal state.
The component model is what makes AI-generated frontends practical. You can ask the AI to "create a pricing card component that accepts a title, price, and feature list" and get a clean, self-contained piece that you can use anywhere in your app. Components are small enough for the AI to generate correctly and modular enough to compose into larger interfaces.
Component libraries like shadcn/ui provide pre-built, customizable components (buttons, dialogs, tables, forms) that follow consistent design patterns. Using a component library with AI is powerful: the AI knows the library's API and generates code that integrates cleanly.