> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ubiquex.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Components

> Reusable infrastructure components from the Strata registry or local paths.

Components encapsulate multiple resources into a single reusable unit. They are referenced with the `component` block and published to the Strata registry.

## Using a Registry Component

```hcl theme={null}
component "platform" {
  source     = "registry.ubiquex.io/eks-platform"
  version    = "2.1.0"
  region     = "eu-west-1"
  node_count = 3
}

output "cluster_endpoint" {
  value = ~component.platform.cluster_endpoint
}
```

## Using a Local Component

```hcl theme={null}
component "vpc" {
  source = "./components/vpc"
  cidr   = "10.0.0.0/16"
  region = input.region
}
```

## Component Source Formats

| Format            | Example                                             |
| ----------------- | --------------------------------------------------- |
| Short name        | `eks-platform` → `registry.ubiquex.io/eks-platform` |
| Full registry URL | `registry.ubiquex.io/eks-platform`                  |
| Local path        | `./components/vpc`                                  |

## Under the Hood

Registry components are TypeScript Pulumi ComponentResources packaged as npm packages:

```typescript theme={null}
// Generated TypeScript
import { EksPlatform } from "@ubiquex/eks-platform";

const platform = new EksPlatform("platform", {
    region: "eu-west-1",
    nodeCount: 3,
});
```

## Publishing Components

```bash theme={null}
ubx publish                         # publish current directory
ubx publish --version 2.1.0
```

See [`ubx publish`](/v1/cli/publish) for details.

## Native .iac Components (Planned)

A future version of ubx will support writing components in `.iac` syntax:

```hcl theme={null}
# components/vpc/main.iac
input "cidr" { type = "string" }

unit "aws_vpc" "main" {
  cidr_block = input.cidr
}

output "vpc_id" {
  value = ~unit.aws_vpc.main.id
}
```

This eliminates the need for TypeScript knowledge to write reusable components.
