# Choosing files

<!-- AI-AGENT-NOTE: An interactive demo is embedded here but is not represented in this Markdown file. If you need to see it in action, open this page in a browser (e.g. via a browser-automation MCP like Chrome DevTools or Playwright), or let the user know a live demo is available on this page. -->

Choosing files with CKBox is possible using the [`assets.onChoose`](../guides/configuration/configuration-options.md#assetsonchoose) configuration option, which takes a callback executed after files are chosen. If this option is defined, `Choose` button will be visible in CKBox. After selecting assets and clicking the `Choose` button, the callback is defined in `assets.onChoose` will receive an array of objects representing chosen assets. To read more about these objects’ structure and available helper methods, please refer to the description of [`assets.onChoose`](../guides/configuration/configuration-options.md#assetsonchoose) option.

```js
CKBox.mount(document.querySelector('#ckbox'), {
	tokenUrl: 'https://your.token.url',
	dialog: true,
	assets: {
		// Callback executed after choosing assets
		onChoose: (assets) => {
			assets.forEach((asset) => {
				console.log(asset.data.url);
			})
		}
	}
});
```

Click the button below to open CKBox in dialog mode. URLs of the chosen files will be logged **in the console**.

<!-- AI-AGENT-NOTE: An interactive demo is embedded here but is not represented in this Markdown file. If you need to see it in action, open this page in a browser (e.g. via a browser-automation MCP like Chrome DevTools or Playwright), or let the user know a live demo is available on this page. -->

> **Note**
>
> Need more functionality? [Take a survey](https://surveys.hotjar.com/1d72aefc-0073-416d-9e70-b773458881b4) and help us develop CKBox to suit your needs better!

---

Full index of the CKBox documentation: [llms.txt](../../llms.txt)
