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

# openfolderdialog

> Mo Windows folder picker thong qua Windows file picker voi folder selection mode va tra ve thu muc da chon duoi dang file item.

<div className="real-function-page">
  ```lua theme={null}
  openfolderdialog(options?: DialogOptions): FileSystemItem | nil
  ```

  ## Đối số

  <ParamField path={"options"} type={"DialogOptions"}>
    Optional table. Voi openfolderdialog, title va defaultPath duoc su dung. defaultPath chi duoc ap dung khi resolve thanh existing directory. extensionFilter duoc shared dialog options parser chap nhan, nhung folder selection duoc bat bang folder selection mode.
  </ParamField>

  ## Giá trị trả về

  <ResponseField name={"folder"} type={"FileSystemItem | nil"}>
    Selected folder item, hoac nil khi dialog bi huy. Dialog failures se throw Failed to open folder dialog.
  </ResponseField>

  ## Kiểu

  ### DialogOptions

  Định cấu hình hộp thoại chọn tệp hoặc thư mục gốc.

  | Name               | Type                 | Required | Mô tả                                                                                              |
  | ------------------ | -------------------- | -------- | -------------------------------------------------------------------------------------------------- |
  | `title`            | `string`             | No       | Đặt tiêu đề cửa sổ hộp thoại.                                                                      |
  | `defaultPath`      | `string`             | No       | Chọn thư mục hiển thị khi hộp thoại mở ra.                                                         |
  | `extensionFilter`  | `&#123;string&#125;` | No       | Giới hạn các tệp có thể chọn ở các tiện ích mở rộng được liệt kê, có hoặc không có dấu chấm ở đầu. |
  | `suggestedName`    | `string`             | No       | Cung cấp tên tệp ban đầu trong hộp thoại lưu.                                                      |
  | `defaultExtension` | `string`             | No       | Đặt phần mở rộng được sử dụng khi tên tệp đã nhập không có.                                        |

  ## Ví dụ

  Mo folder picker va xu ly selected folder item hoac cancellation.

  ```lua theme={null}
  local folder = openfolderdialog({
      title = "Choose a folder",
      defaultPath = ".",
  })

  if folder then
      print(folder:GetName())
      print(folder:IsFolder())
  else
      print("No folder selected")
  end
  ```
</div>
