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

# Preset

> Quản lý các cấu hình render có thể tái sử dụng

Preset là một cấu hình render có thể tái sử dụng — nền, kiểu phụ đề, bố cục và các thiết lập hình ảnh khác — mà bạn có thể áp dụng cho bất kỳ project hoặc export nào. Preset rất phù hợp khi bạn cần một phong cách nhất quán trên nhiều track.

Xem [Render settings reference](/en/render-settings-reference) để biết đầy đủ
cấu trúc `preset` và mọi tùy chọn được hỗ trợ bởi enum.

## `preset schema`

Trả về JSON Schema cho các thiết lập preset. Dùng cái này để khám phá các field hợp lệ trước khi tạo hoặc cập nhật một preset.

```bash theme={null}
youka preset schema --json
```

<Tip>
  Agents nên gọi `preset schema` trước khi chỉnh sửa preset để biết chính xác tên
  field và kiểu giá trị.
</Tip>

## `preset list`

Liệt kê tất cả preset thuộc tài khoản đã xác thực.

```bash theme={null}
youka preset list --json
```

## `preset show`

Lấy một preset theo ID.

```bash theme={null}
youka preset show <presetId> --json
```

## `preset create`

Tạo một preset mới.

```bash theme={null}
youka preset create [options]
```

### Options

| Option             | Description                                 |
| ------------------ | ------------------------------------------- |
| `--name <name>`    | Tên preset                                  |
| `--default`        | Đánh dấu preset mới là preset mặc định      |
| `--body <file\|->` | Đọc toàn bộ request body từ file hoặc stdin |

<Note>
  Request body nên chứa toàn bộ object `preset`. Với payload lớn,
  nên dùng `--body` thay vì JSON inline.
</Note>

### Examples

<CodeGroup>
  ```bash from-file theme={null}
  youka preset create \
    --name "Neon Night" \
    --body ./neon-preset.json \
    --json
  ```

  ```bash make-default theme={null}
  youka preset create \
    --name "Red Cinema" \
    --body ./red-cinema.json \
    --default \
    --json
  ```

  ```bash from-stdin theme={null}
  cat ./preset.json | youka preset create --name "From stdin" --body - --json
  ```
</CodeGroup>

Các flag của CLI sẽ ghi đè các field tương ứng từ `--body`.

## `preset update`

Cập nhật một preset hiện có.

```bash theme={null}
youka preset update <presetId> [options]
```

| Option             | Description                             |
| ------------------ | --------------------------------------- |
| `--name <name>`    | Tên mới                                 |
| `--body <file\|->` | Toàn bộ request body từ file hoặc stdin |

Ví dụ:

```bash theme={null}
youka preset update $PRESET_ID \
  --name "Neon Night v2" \
  --body ./neon-v2.json \
  --json
```

## `preset delete`

Xóa một preset theo ID.

```bash theme={null}
youka preset delete <presetId> --json
```

<Warning>
  Việc xóa một preset không xóa các project hoặc export đã được render trước đó
  bằng preset này. Các export trong tương lai tham chiếu đến preset đã bị xóa sẽ thất bại.
</Warning>

## `preset default`

Lấy hoặc đặt preset mặc định.

```bash theme={null}
youka preset default --json
youka preset default <presetId> --json
```

Khi không có đối số, lệnh trả về preset mặc định hiện tại hoặc `null`. Khi có preset ID, lệnh sẽ đặt preset đó làm mặc định.

## Áp dụng một preset

Áp dụng một preset cho project hoặc export bằng `--preset`:

<CodeGroup>
  ```bash on-create theme={null}
  youka project create ./song.mp3 --preset $PRESET_ID --wait
  ```

  ```bash on-settings-update theme={null}
  youka project settings $PROJECT_ID --preset $PRESET_ID
  ```

  ```bash on-export theme={null}
  youka export create $PROJECT_ID --preset $PRESET_ID --wait
  ```
</CodeGroup>

## Tiếp theo

* [Render settings reference](/en/render-settings-reference) - tất cả các field preset dùng chung
* [Projects](/vi/cli/projects) - áp dụng preset vào thiết lập project
* [Exports](/vi/cli/exports) - áp dụng preset tại thời điểm render
* [Media](/vi/cli/media) - media có thể tái sử dụng được preset tham chiếu
