# facebook/componentkit

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/facebook-componentkit).**

5,787 stars · 580 forks · Objective-C++ · other

## Links

- GitHub: https://github.com/facebook/componentkit
- Homepage: http://www.componentkit.org/
- awesome-repositories: https://awesome-repositories.com/repository/facebook-componentkit.md

## Description

ComponentKit is a declarative UI framework for building iOS interfaces through composition of small, reusable components. It provides a structured approach to constructing user interfaces where each component is defined as an immutable, pure function of its inputs, enabling predictable rendering and state management. The framework supports both stateless and stateful components, with controllers that can be attached to manage persistent state across component updates.

The framework distinguishes itself through its component architecture that emphasizes explicit data flow and compile-time safety. Components communicate through a responder chain using explicitly defined action targets, with support for parameter promotion and demotion between parent and child components. The system enforces type safety at compile time, catching component type mismatches before runtime, and provides mechanisms for passing data through the component tree without manual prop threading at every level.

ComponentKit includes a comprehensive layout system based on flexbox, with support for relative sizing, inline layout metrics, and viewless components that position subviews without allocating views. The framework handles UI rendering through collection views where each cell is generated by thread-safe class methods, with asynchronous layout computation and view recycling to optimize performance. Animation support allows property changes, component appearance and disappearance, and state-driven animations to be triggered declaratively.

The framework provides debugging tools including visual inspection of the component hierarchy and phantom views for invisible components, along with lifecycle hooks for mount, update, and unmount phases. Documentation covers component construction, layout configuration, data synchronization with collection views, and best practices for code organization and naming conventions.

## Tags

### User Interface & Experience

- [Reusable UI Components](https://awesome-repositories.com/f/user-interface-experience/reusable-ui-components.md) — Builds interfaces by composing small, self-contained components rather than subclassing views. ([source](http://www.componentkit.org/docs/never-subclass-components))
- [Collection View Batch Operations](https://awesome-repositories.com/f/user-interface-experience/cell-data-manipulation/batch-updates/collection-view-batch-operations.md) — Enqueues batch UI changes for collection views, applying multiple operations atomically. ([source](http://www.componentkit.org/docs/datasource-changeset-api))
- [Component Data Passing](https://awesome-repositories.com/f/user-interface-experience/component-architectures/component-communication-patterns/component-data-passing.md) — Passes data through the component tree implicitly, avoiding manual prop threading at every level. ([source](http://www.componentkit.org/docs/component-context))
- [Component State Managers](https://awesome-repositories.com/f/user-interface-experience/component-state-managers.md) — Creates components that manage internal state to determine rendered content and behavior. ([source](http://www.componentkit.org/docs/break-out-composites))
- [Pure Components](https://awesome-repositories.com/f/user-interface-experience/component-utilities/ui-frameworks/rendering-models/composition-rendering-patterns/component-patterns/pure-components.md) — Builds view components as pure functions that transform input data into component trees without side effects. ([source](http://www.componentkit.org/docs/avoid-local-variables))
- [Declarative UI Frameworks](https://awesome-repositories.com/f/user-interface-experience/component-utilities/ui-frameworks/rendering-models/declarative-frameworks/declarative-ui-frameworks.md) — Describes UI elements using a declarative API based on immutable inputs, leaving rendering to the framework. ([source](http://componentkit.org/))
- [Model-Driven Component Updates](https://awesome-repositories.com/f/user-interface-experience/component-utilities/ui-frameworks/rendering-models/ui-component-models/model-driven-component-updates.md) — Triggers component re-renders when the model or context object changes via the hosting view. ([source](http://www.componentkit.org/docs/infrastructure/component-hosting-view))
- [Model-to-Component Transforms](https://awesome-repositories.com/f/user-interface-experience/component-utilities/ui-frameworks/rendering-models/ui-component-models/model-to-component-transforms.md) — Defines stateless class methods that map models and immutable contexts to components. ([source](http://www.componentkit.org/docs/datasource-basics))
- [Hierarchy Flattening](https://awesome-repositories.com/f/user-interface-experience/composition-hierarchies/view-hierarchy-composition/adaptive-view-hierarchies/hierarchy-flattening.md) — Flattens the view tree by removing redundant nested containers to reduce rendering depth. ([source](http://componentkit.org/))
- [Parameterized Component Customizations](https://awesome-repositories.com/f/user-interface-experience/custom-ui-components/parameterized-component-customizations.md) — Passes configuration values like colors as constructor arguments instead of overriding methods in subclasses. ([source](http://www.componentkit.org/docs/never-subclass-components))
- [Declarative UI Components](https://awesome-repositories.com/f/user-interface-experience/declarative-ui-components.md) — Provides a declarative API for composing reusable view components from immutable inputs. ([source](http://www.componentkit.org/docs/getting-started))
- [Flexbox Layout Engines](https://awesome-repositories.com/f/user-interface-experience/flexbox-layout-engines.md) — Includes a flexbox layout engine for declaring child components inline with automatic nil dropping. ([source](http://www.componentkit.org/docs/avoid-push-back))
- [Component Events](https://awesome-repositories.com/f/user-interface-experience/form-and-input-management/interaction-and-event-handling/event-handling-architectures/component-events.md) — Wraps method selectors and targets so child components signal events up the responder chain. ([source](http://www.componentkit.org/docs/actions))
- [State-Driven Animations](https://awesome-repositories.com/f/user-interface-experience/ui-animations/state-driven-animations.md) — Triggers animations by regenerating the component tree after state or props updates. ([source](http://www.componentkit.org/docs/animations-general-principles))
- [Animation Transition Components](https://awesome-repositories.com/f/user-interface-experience/ui-components/animation-transition-components.md) — Animates component entry onto the screen by wrapping it in an animation component. ([source](http://www.componentkit.org/docs/animations-initial-and-final))
- [Changeset Application](https://awesome-repositories.com/f/user-interface-experience/view-to-data-mappings/changeset-application.md) — Applies changesets to collection data, computing components and updating the view asynchronously. ([source](http://www.componentkit.org/docs/datasource-basics))
- [Explicit Action Target Binding](https://awesome-repositories.com/f/user-interface-experience/action-trigger-components/explicit-action-target-binding.md) — Binds actions to explicit component targets to ensure messages reach the intended receiver. ([source](http://www.componentkit.org/docs/actions))
- [Automatic Property Animations](https://awesome-repositories.com/f/user-interface-experience/animation-and-motion-systems/configuration-utility-helpers/animation-properties/automatic-property-animations.md) — Animates component properties by automatically inferring start and end values from state changes. ([source](http://www.componentkit.org/docs/animations-change))
- [Parallel Property Animations](https://awesome-repositories.com/f/user-interface-experience/animation-and-motion-systems/configuration-utility-helpers/animation-properties/parallel-property-animations.md) — Runs several property animations in parallel on the same component for simultaneous visual changes. ([source](http://www.componentkit.org/docs/animations-change))
- [Child Component Change Animations](https://awesome-repositories.com/f/user-interface-experience/component-animation-hooks/child-component-change-animations.md) — Animates layout or property changes on a child component by returning an animation from the parent. ([source](http://www.componentkit.org/docs/animations-change))
- [Component-to-Controller Data Exposure](https://awesome-repositories.com/f/user-interface-experience/component-architectures/component-communication-patterns/component-data-passing/component-to-controller-data-exposure.md) — Exposes component properties to controllers for reading during initialization and state changes. ([source](http://www.componentkit.org/docs/component-controllers))
- [Explicit Action Selector Passing](https://awesome-repositories.com/f/user-interface-experience/component-architectures/component-communication-patterns/component-data-passing/explicit-action-selector-passing.md) — Passes action selectors explicitly between components to prevent hidden coupling and runtime errors. ([source](http://www.componentkit.org/docs/pass-in-actions))
- [Relative Parent Sizing](https://awesome-repositories.com/f/user-interface-experience/component-child-utilities/instance-references/parent-accessors/relative-parent-sizing.md) — Sizes components as a percentage of their parent container for responsive full-width layouts. ([source](http://www.componentkit.org/docs/avoid-width-100-percent))
- [Hierarchy Traversers](https://awesome-repositories.com/f/user-interface-experience/component-hierarchies/hierarchy-traversers.md) — Sends actions upward through the mounted component hierarchy until a handler is found. ([source](http://www.componentkit.org/docs/actions))
- [Single Designated Initializers](https://awesome-repositories.com/f/user-interface-experience/component-initialization/single-designated-initializers.md) — Exposes all parameters in a single designated initializer to avoid method overrides. ([source](http://www.componentkit.org/docs/avoid-overrides))
- [Component Sizing Utilities](https://awesome-repositories.com/f/user-interface-experience/component-sizing-utilities.md) — Provides size range providers that calculate bounding sizes based on available space. ([source](http://www.componentkit.org/docs/infrastructure/component-hosting-view))
- [Controller-Initiated State Updates](https://awesome-repositories.com/f/user-interface-experience/controlled-components/controller-initiated-state-updates.md) — Allows controllers to trigger component state changes by calling update methods with new values. ([source](http://www.componentkit.org/docs/component-controllers))
- [Cross-Axis Stretching](https://awesome-repositories.com/f/user-interface-experience/flexbox-layouts/cross-axis-stretching.md) — Stretches child components to fill the parent's cross-axis width in flexbox layouts. ([source](http://www.componentkit.org/docs/avoid-width-100-percent))
- [Responder Chain Delegate Proxies](https://awesome-repositories.com/f/user-interface-experience/input-handling/callback-delegates/responder-chain-delegate-proxies.md) — Forwards view delegate callbacks into the component responder chain to avoid lifecycle issues. ([source](http://www.componentkit.org/docs/components-cant-be-delegates))
- [State Comparison Animation Triggers](https://awesome-repositories.com/f/user-interface-experience/lifecycle-animation-triggers/state-comparison-animation-triggers.md) — Compares current and previous state to decide which property animations to return, avoiding unnecessary work. ([source](http://www.componentkit.org/docs/animations-change))
- [Co-located Controller Definitions](https://awesome-repositories.com/f/user-interface-experience/presentation-frameworks/lifecycle-state-management/javascript-component-controllers/co-located-controller-definitions.md) — Encourages co-locating controller logic with component definitions for local state management clarity. ([source](http://www.componentkit.org/docs/keep-controller-in-component))

### Part of an Awesome List

- [Component-Powered Collection Views](https://awesome-repositories.com/f/awesome-lists/ai/document-q-a/component-powered-collection-views.md) — Renders collection views where each cell is generated by a pure, thread-safe model-to-component transform. ([source](http://www.componentkit.org/docs/datasource-basics))
- [UI Components](https://awesome-repositories.com/f/awesome-lists/devtools/ui-components.md) — Breaks complex components into smaller, focused sub-components composed together for readability. ([source](http://www.componentkit.org/docs/avoid-excessive-branching))
- [View-Backed Components](https://awesome-repositories.com/f/awesome-lists/devtools/view-components/view-backed-components.md) — Creates native view subclasses automatically and reuses views across component updates. ([source](http://www.componentkit.org/docs/views))
- [State-Driven Insertion Tracking](https://awesome-repositories.com/f/awesome-lists/devtools/code-transformers/positional-insertions/state-driven-insertion-tracking.md) — Tracks insertion positions from component state to avoid race conditions with the list view. ([source](http://www.componentkit.org/docs/datasource-gotchas))
- [Small Component Composition](https://awesome-repositories.com/f/awesome-lists/devtools/ui-components/small-component-composition.md) — Encourages splitting oversized component files into smaller composite components for maintainability. ([source](http://www.componentkit.org/docs/under-300-lines))
- [Declarative Layout Modifiers](https://awesome-repositories.com/f/awesome-lists/devtools/ui-layout-components/declarative-layout-modifiers.md) — Ships a declarative builder API for adjusting component padding, alignment, and child composition. ([source](http://www.componentkit.org/docs/getting-started))
- [View Mutation Hooks](https://awesome-repositories.com/f/awesome-lists/devtools/view-components/view-mutation-hooks.md) — Provides lifecycle hooks to mutate the underlying UIView for animations and delegate integration. ([source](http://www.componentkit.org/docs/lifecycle-methods))
- [Viewless Components](https://awesome-repositories.com/f/awesome-lists/devtools/view-components/viewless-components.md) — Supports viewless components that position subviews without allocating native views. ([source](http://www.componentkit.org/docs/views))

### Development Tools & Productivity

- [Stack-Allocated Component Trees](https://awesome-repositories.com/f/development-tools-productivity/build-tooling/asset-file-management/asset-processing-pipelines/asset-transformation-pipelines/component-build-processors/stack-allocated-component-trees.md) — Builds component trees on the stack using value semantics to minimize memory allocation overhead. ([source](http://www.componentkit.org/docs/why-cpp))
- [Component Inspection Tools](https://awesome-repositories.com/f/development-tools-productivity/debugging-profiling-testing/debugging-diagnostics/debugging-inspection-tools/component-inspection-tools.md) — Provides component inspection tools for examining the visual layout of components in the hierarchy. ([source](http://www.componentkit.org/docs/debugging))

### Mobile Development

- [Asynchronous Layout Calculation](https://awesome-repositories.com/f/mobile-development/asynchronous-layout-calculation.md) — Computes UI layout positions on background threads to prevent blocking user interaction. ([source](http://componentkit.org/))
- [Component Controller Attachments](https://awesome-repositories.com/f/mobile-development/component-controller-attachments.md) — Provides a mechanism to attach persistent controllers to components for state management across updates. ([source](http://www.componentkit.org/docs/component-controllers))

### Programming Languages & Runtimes

- [Component Collection Rendering](https://awesome-repositories.com/f/programming-languages-runtimes/built-in-data-collections/component-collection-rendering.md) — Renders components in a collection view by generating and laying them out from changesets. ([source](http://www.componentkit.org/docs/datasource-overview))
- [Component Type Mismatch Detection](https://awesome-repositories.com/f/programming-languages-runtimes/compile-time-type-constraints/component-type-mismatch-detection.md) — Catches component type mismatches at compile time using C++ type safety instead of runtime errors. ([source](http://www.componentkit.org/docs/why-cpp))

### Software Engineering & Architecture

- [Lifecycle Event Hooks](https://awesome-repositories.com/f/software-engineering-architecture/lifecycle-event-hooks.md) — Provides lifecycle event hooks for mount, update, unmount, and view acquisition phases. ([source](http://www.componentkit.org/docs/lifecycle-methods))
- [Component Context Sharing](https://awesome-repositories.com/f/software-engineering-architecture/shared-state-management/component-context-sharing.md) — Shares mutable context between component generations, preventing reuse bugs through derived values. ([source](http://www.componentkit.org/docs/component-context))
- [Style Parameter Struct Grouping](https://awesome-repositories.com/f/software-engineering-architecture/dependency-parameter-grouping/style-parameter-struct-grouping.md) — Groups optional parameters into a plain struct to keep component initializers small and callers set only needed fields. ([source](http://www.componentkit.org/docs/avoid-overrides))
- [Index Path Model Queries](https://awesome-repositories.com/f/software-engineering-architecture/runtime-path-resolvers/path-normalizers/path-relation-calculations/relative-path-indexing/index-path-model-queries.md) — Queries the data source for models by index path, maintaining accuracy during asynchronous updates. ([source](http://www.componentkit.org/docs/datasource-gotchas))
- [Index Path Model Retrieval](https://awesome-repositories.com/f/software-engineering-architecture/single-source-of-truth-modeling/index-path-model-retrieval.md) — Retrieves models from the data source by index path, maintaining the datasource as the single source of truth. ([source](http://www.componentkit.org/docs/datasource-basics))

### Web Development

- [Nil-Safe Children](https://awesome-repositories.com/f/web-development/children-management/nil-safe-children.md) — Provides nil-safe child arrays that eliminate conditional branching in component composition. ([source](http://www.componentkit.org/docs/why-cpp))
- [Sub-Component Compositions](https://awesome-repositories.com/f/web-development/component-based-architectures/component-based-architectures/ui-component-abstractions/sub-component-compositions.md) — Wraps components inside new ones to hide internal implementation and expose simpler public interfaces. ([source](http://www.componentkit.org/docs/composite-components))
- [View Recycling](https://awesome-repositories.com/f/web-development/dom-element-manipulators/view-recycling.md) — Reuses off-screen view objects to minimize allocation and improve rendering performance. ([source](http://componentkit.org/))

### Content Management & Publishing

- [Concise Component Tree Syntax](https://awesome-repositories.com/f/content-management-publishing/concise-markup-syntax/concise-component-tree-syntax.md) — Builds component trees with minimal boilerplate using C++ aggregate initialization and default-valued fields. ([source](http://www.componentkit.org/docs/why-cpp))

### Data & Databases

- [Lifecycle-Synchronized Data Sources](https://awesome-repositories.com/f/data-databases/data-sources/view-data-providers/lifecycle-synchronized-data-sources.md) — Synchronizes the data source lifecycle with the list view to prevent crashes from out-of-sync content. ([source](http://www.componentkit.org/docs/datasource-gotchas))
- [Ordered Collection Updates](https://awesome-repositories.com/f/data-databases/search-indexing/in-memory-indexing/ordered-collection-updates.md) — Implements ordered batch updates to collection views, processing deletions before insertions. ([source](http://www.componentkit.org/docs/datasource-changeset-api))
- [Named Field Initializers](https://awesome-repositories.com/f/data-databases/tuple-data-structures/named-tuple-structs/named-field-initializers.md) — Supports named field initialization for structs, improving code readability and safety. ([source](http://www.componentkit.org/docs/use-designated-initializer-style))

### Graphics & Multimedia

- [Standalone Component Hosts](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/systems/dom-web-rendering-strategies/ui-component-rendering/standalone-component-hosts.md) — Renders single components outside collection views via hosting views that manage layout and updates. ([source](http://www.componentkit.org/docs/infrastructure/component-hosting-view))
