# `Beancount.Directives.Custom`
[🔗](https://github.com/thanos/beancount_ex/blob/v0.6.0/lib/beancount/directives/custom.ex#L1)

The `custom` directive is a generic, user-defined directive.

See [Custom](https://beancount.github.io/docs/beancount_language_syntax/#custom).

## Beancount syntax

    2026-01-01 custom "budget" Expenses:Food #monthly 400.00 USD

General form: `YYYY-MM-DD custom "Type" Value...`

## Elixir struct

    %Beancount.Directives.Custom{
      date: ~D[2026-01-01],
      type: "budget",
      values: [
        Beancount.account_value("Expenses:Food"),
        Beancount.tag_value("monthly"),
        Beancount.amount_value(Decimal.new("400.00"), "USD")
      ],
      metadata: %{}
    }

Or use `Beancount.custom/4`:

    Beancount.custom(~D[2026-01-01], "budget", [
      Beancount.account_value("Expenses:Food"),
      Beancount.tag_value("monthly"),
      Beancount.amount_value(Decimal.new("400.00"), "USD")
    ])

Plain strings, `Decimal`, `Date`, booleans, and atoms are also valid `values`.

## Fields

  * `date` - `Date.t()` the custom entry applies to.
  * `type` - user-defined directive name (quoted in `.bean` text).
  * `values` - ordered list of scalars rendered after `type`. Use
    `Beancount.account_value/1`, `Beancount.tag_value/1`, and
    `Beancount.amount_value/2` for typed Beancount tokens.
  * `metadata` - optional map rendered below the directive.

# `t`

```elixir
@type t() :: %Beancount.Directives.Custom{
  date: Date.t(),
  metadata: map(),
  type: String.t(),
  values: [term()]
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
