# add_slicer { #powerbpy.add_slicer }

```python
add_slicer(
    data_source,
    column_name,
    dashboard_path,
    page_id,
    slicer_id,
    height,
    width,
    x_position,
    y_position,
    z_position=6000,
    tab_order=-1001,
    title=None,
    text_align='left',
    font_weight='bold',
    font_size=32,
    font_color='#000000',
    background_color=None,
    parent_group_id=None,
)
```

Add a slicer to a page

## Parameters {.doc-section .doc-section-parameters}

| Name             | Type   | Description                                                                                                                                                                                                                                                                                                                                                    | Default     |
|------------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|
| data_source      | str    | This is the name of the dataset that you want to use to populate the slicer with                                                                                                                                                                                                                                                                               | _required_  |
| column_name      | str    | This is the name of the measure (or variable) name you want to use to populate the slicer with                                                                                                                                                                                                                                                                 | _required_  |
| dashboard_path   | str    | The path where the dashboard files are stored. (This is the top level directory containing the .pbip file and Report and SemanticModel folders).                                                                                                                                                                                                               | _required_  |
| page_id          | str    | The unique id for the page you want to add the slicer to. If you used this package's functions it will be in the format page1, page2, page3, page4, etc. If you manually created the page it will be a randomly generated UUID. To find a page's page id, consult the report > definition> pages > page.json file and look in the page order list.             | _required_  |
| slicer_id        | str    | Please choose a unique id to use to identify the slicer. PBI defaults to using a UUID, but it'd probably be easier if you choose your own id.                                                                                                                                                                                                                  | _required_  |
| height           | int    | Height of slicer on the page                                                                                                                                                                                                                                                                                                                                   | _required_  |
| width            | int    | Width of slicer on the page                                                                                                                                                                                                                                                                                                                                    | _required_  |
| x_position       | int    | The x coordinate of where you want to put the slicer on the page. Origin is page's top left corner.                                                                                                                                                                                                                                                            | _required_  |
| y_position       | int    | The y coordinate of where you want to put the slicer on the page. Origin is page's top left corner.                                                                                                                                                                                                                                                            | _required_  |
| z_position       | int    | The z index for the visual. (Larger number means more to the front, smaller number means more to the back). Defaults to 6000                                                                                                                                                                                                                                   | `6000`      |
| tab_order        | int    | The order which the screen reader reads different elements on the page. Defaults to -1001 for now. (I need to do more to figure out what the numbers correpond to. It should also be possible to create a function to automatically order this left to right top to bottom by looping through all the visuals on a page and comparing their x and y positions) | `-1001`     |
| title            | str    | An optional title to add to the slicer.                                                                                                                                                                                                                                                                                                                        | `None`      |
| text_align       | str    | How would you like the text aligned (available options: "left", "right", "center")                                                                                                                                                                                                                                                                             | `'left'`    |
| font_weight      | str    | This is an option to change the font's weight. Defaults to bold. Available options include: ["bold"]                                                                                                                                                                                                                                                           | `'bold'`    |
| font_size        | int    | The font size in pts. Must be a whole integer. Defaults to 32 pt                                                                                                                                                                                                                                                                                               | `32`        |
| font_color       | str    | Hex code for the font color you'd like to use. Defaults to black (#000000)                                                                                                                                                                                                                                                                                     | `'#000000'` |
| background_color | str    | Hex code for the background color of the slicer. Defaults to None (transparent)                                                                                                                                                                                                                                                                                | `None`      |
| parent_group_id  | str    | This should be a valid id code for another power BI visual. If supplied the current visual will be nested inside the parent group.    This function creates a new slicer on a page.                                                                                                                                                                            | `None`      |