Follow the below steps:
1. Create slicer of the field required.
2. No go to Format tab and go to Items as below
3. Change the background color as required and change the font size.
4. Now change the object size vertically.
5. Go to General and change the orientation to Horizontal.
You would get a slicer like above in the form of buttons.
Change the background, font color, and size as per requirement.
Hope it helps you!