# Closed Components

URL: https://ark-ui.com/docs/guides/closed-components
Source: https://raw.githubusercontent.com/chakra-ui/ark/refs/heads/main/website/src/content/pages/guides/closed-components.mdx

Learn how to create reusable components using the example of an avatar

---

## Motivation

Writing a few lines of code every time you need a simple `Avatar` is tedious. Creating a dedicated component
encapsulates logic, simplifies the API, ensures consistent usage, and maintains clean code. This approach enhances
reusability, making the component easier to maintain and test.

Here's an example of an `Avatar` component that can be used consistently across your application:

<Example id="closed" component="avatar" />

## Usage

To use the `Avatar` component, pass the `name` and `src` props as shown below:

```jsx
<Avatar name="Christian" src="https://avatars.githubusercontent.com/u/1846056?v=4" />
```