1e41f4b71Sopenharmony_ci# @ohos.file.AlbumPickerComponent (AlbumPickerComponent)
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe **AlbumPickerComponent** component embedded in the UI of an application allows the application to access the albums in the user directory without any permission.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciThis component must be used together with [PhotoPickerComponent](ohos-file-PhotoPickerComponent.md). When a user selects an album by using **AlbumPickerComponent**, **PhotoPickerComponent** is instructed to update the photos and videos in the album.
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci> **NOTE**
8e41f4b71Sopenharmony_ci>
9e41f4b71Sopenharmony_ci> This component is supported since API version 12. Updates will be marked with a superscript to indicate their earliest API version.
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci## Modules to Import
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci```ts
14e41f4b71Sopenharmony_ciimport { AlbumPickerComponent, AlbumPickerOptions, AlbumInfo } from '@kit.MediaLibraryKit';
15e41f4b71Sopenharmony_ci```
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci## Properties
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ciThe [universal properties](../apis-arkui/arkui-ts/ts-universal-attributes-size.md) are supported.
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci## AlbumPickerComponent
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ciAlbumPickerComponent({
24e41f4b71Sopenharmony_ci  albumPickerOptions?: AlbumPickerOptions,
25e41f4b71Sopenharmony_ci  onAlbumClick?: (albumInfo: AlbumInfo) => boolean
26e41f4b71Sopenharmony_ci})
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ciAllows the application to access the albums in the user directory without any permission.
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci**Decorator**: @Component
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci**Parameters**
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description   |
39e41f4b71Sopenharmony_ci|-------|-------|-----|------------|
40e41f4b71Sopenharmony_ci| albumPickerOptions    | [AlbumPickerOptions](#albumpickeroptions) | No  |  **AlbumPicker** configuration.                         |
41e41f4b71Sopenharmony_ci| onAlbumClick  | (albumInfo: [AlbumInfo](#albuminfo)) => boolean   | No  |  Callback used to return the album URI when an album is selected by a user.  |
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ci## AlbumPickerOptions
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ciRepresents the **AlbumPicker** configuration.
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description   |
52e41f4b71Sopenharmony_ci|------|-------|-----|----------|
53e41f4b71Sopenharmony_ci| themeColorMode  | [PickerColorMode](ohos-file-PhotoPickerComponent.md#pickercolormode) | No  | Theme color of the album page. The options are **AUTO**, **Light**, and **Dark**. The default value is **AUTO**.|
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci## AlbumInfo
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ciRepresents album information.
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description   |
64e41f4b71Sopenharmony_ci|------|------|-----|---------|
65e41f4b71Sopenharmony_ci| uri  | string | No  | Album URI.|
66e41f4b71Sopenharmony_ci| albumName  | string | No  | Album name.|
67e41f4b71Sopenharmony_ci
68e41f4b71Sopenharmony_ci## Example
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ci```ts
71e41f4b71Sopenharmony_ci// xxx.ets
72e41f4b71Sopenharmony_ciimport { AlbumPickerComponent, AlbumPickerOptions, AlbumInfo, PickerColorMode } from '@kit.MediaLibraryKit';
73e41f4b71Sopenharmony_ci
74e41f4b71Sopenharmony_ci@Entry
75e41f4b71Sopenharmony_ci@Component
76e41f4b71Sopenharmony_cistruct PickerDemo {
77e41f4b71Sopenharmony_ci  albumPickerOptions: AlbumPickerOptions = new AlbumPickerOptions();
78e41f4b71Sopenharmony_ci
79e41f4b71Sopenharmony_ci  aboutToAppear() {
80e41f4b71Sopenharmony_ci    this.albumPickerOptions.themeColorMode = PickerColorMode.AUTO;
81e41f4b71Sopenharmony_ci  }
82e41f4b71Sopenharmony_ci  
83e41f4b71Sopenharmony_ci  private onAlbumClick(albumInfo: AlbumInfo): boolean {
84e41f4b71Sopenharmony_ci    if (albumInfo?.uri) {
85e41f4b71Sopenharmony_ci      // pickerController instructs PhotoPickerComponent to refresh data.
86e41f4b71Sopenharmony_ci    }
87e41f4b71Sopenharmony_ci    if (albumInfo?.albumName) {
88e41f4b71Sopenharmony_ci      // Perform subsequent processing based on the obtained albumName.
89e41f4b71Sopenharmony_ci    }
90e41f4b71Sopenharmony_ci    return true;
91e41f4b71Sopenharmony_ci  }
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci  build() {
94e41f4b71Sopenharmony_ci    Stack() {
95e41f4b71Sopenharmony_ci      AlbumPickerComponent({
96e41f4b71Sopenharmony_ci        albumPickerOptions: this.albumPickerOptions,
97e41f4b71Sopenharmony_ci        onAlbumClick:(albumInfo: AlbumInfo): boolean => this.onAlbumClick(albumInfo),
98e41f4b71Sopenharmony_ci      }).height('100%').width('100%')
99e41f4b71Sopenharmony_ci    }
100e41f4b71Sopenharmony_ci  }
101e41f4b71Sopenharmony_ci}
102e41f4b71Sopenharmony_ci
103e41f4b71Sopenharmony_ci```