# Set value of checklist by label when options is given as list of dicts

**URL:** https://community.plotly.com/t/set-value-of-checklist-by-label-when-options-is-given-as-list-of-dicts/61978
**Category:** Dash Python
**Tags:** question
**Created:** [March 16, 2022, 9:58am UTC](https://community.plotly.com/t/set-value-of-checklist-by-label-when-options-is-given-as-list-of-dicts/61978 "2022-03-16T09:58:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![lambdakappatheta](https://avatars.discourse-cdn.com/v4/letter/l/bbce88/32.png) [@lambdakappatheta](https://community.plotly.com/u/lambdakappatheta)
#### Post date: [March 16, 2022, 9:58am UTC](https://community.plotly.com/t/set-value-of-checklist-by-label-when-options-is-given-as-list-of-dicts/61978/1 "2022-03-16T09:58:40Z")

</div>

Hi! So this works as expected and the first two options are selected by default:

```auto
app.layout = html.Div([dcc.Checklist(
        id='checklist',
        options={str(i): f'{10 + i}' for i in range(5)},
        value=['0', '1'],
)

```

In this example, however, nothing is selected by default:

```auto
app.layout = html.Div([dcc.Checklist(
        id='checklist',
        options=[{'label': str(i), 'value': f'{10 + i}'} for i in range(5)],
        value=['0', '1'],
)

```

This works as well:

```auto
app.layout = html.Div([dcc.Checklist(
        id='checklist',
        options=[{'label': str(i), 'value': f'{10 + i}'} for i in range(5)],
        value=['10', '11'],
)

```

But I would like to use the labels instead.

By the way, this also doesn’t work (returns errors):

```auto
app.layout = html.Div([dcc.Checklist(
        id='checklist',
        options=[{'label': str(i), 'value': f'{10 + i}'} for i in range(5)],
        value=[{'label': '10'}, {'label': '11'}],
)

```

---

<div class="post-metadata">

### Author: ![adamschroeder](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/adamschroeder/32/17280_2.png) [@adamschroeder](https://community.plotly.com/u/adamschroeder)
#### Post date: [March 17, 2022, 11:57am UTC](https://community.plotly.com/t/set-value-of-checklist-by-label-when-options-is-given-as-list-of-dicts/61978/2 "2022-03-17T11:57:13Z")

</div>

> [@lambdakappatheta](#):
>
> ```auto
> app.layout = html.Div([dcc.Checklist(
> id='checklist',
> options=[{'label': str(i), 'value': f'{10 + i}'} for i in range(5)],
> value=['0', '1'],
> )
> 
> ```

Hi @lambdakappatheta  
This piece of code won’t work because if the first label is selected its value is 10. So choosing the default values 0 or 1 won’t do anything because they don’t exist.
