All Projects → AnthonMS → ha-slider-card

AnthonMS / ha-slider-card

Licence: other
Custom Slider Card for Home Assistant

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to ha-slider-card

Flutter Circular Slider
A customizable circular slider for Flutter.
Stars: ✭ 183 (+662.5%)
Mutual labels:  slider
Numberslidingpicker
Android Number Picker with gestures
Stars: ✭ 225 (+837.5%)
Mutual labels:  slider
TimeRangePicker
A customizable, easy-to-use, and functional circular time range picker library for Android. Use this library to mimic Apple's iOS or Samsung's bedtime picker.
Stars: ✭ 266 (+1008.33%)
Mutual labels:  slider
Vue Infinite Slide Bar
∞ Infinite slide bar component (no dependency and light weight 1.48 KB)
Stars: ✭ 190 (+691.67%)
Mutual labels:  slider
React Native Swiper Flatlist
👆 Swiper component implemented with FlatList using Hooks & Typescript + strict automation tests with Detox
Stars: ✭ 217 (+804.17%)
Mutual labels:  slider
React Flickity Component
A React.js component for using @desandro's Flickity
Stars: ✭ 232 (+866.67%)
Mutual labels:  slider
React Swipes
🔥 基于React的移动端卡片滑动组件
Stars: ✭ 177 (+637.5%)
Mutual labels:  slider
wui
Collection of GUI widgets for the web
Stars: ✭ 44 (+83.33%)
Mutual labels:  slider
Rangetouch
A super tiny library to make `<input type='range'>` sliders work better on touch devices
Stars: ✭ 224 (+833.33%)
Mutual labels:  slider
Flutter fluid slider
A fluid design slider that works just like the Slider material widget.
Stars: ✭ 232 (+866.67%)
Mutual labels:  slider
Sliderawesome
A slider plugin full of various effects and styles that allows any customization. 一款可定制的风格效果多样的轮播图插件。
Stars: ✭ 204 (+750%)
Mutual labels:  slider
React Slider Kit
react-slider-kit is going to be a comprehensive solution to slider feature in react.
Stars: ✭ 219 (+812.5%)
Mutual labels:  slider
Roundslider
roundSlider - A free jQuery plugin
Stars: ✭ 232 (+866.67%)
Mutual labels:  slider
Angular Bootstrap Slider
an angularjs directive for seiyria-bootstrap-slider
Stars: ✭ 183 (+662.5%)
Mutual labels:  slider
vue-splide
The Splide component for Vue.
Stars: ✭ 257 (+970.83%)
Mutual labels:  slider
Hgcircularslider
A custom reusable circular / progress slider control for iOS application.
Stars: ✭ 2,240 (+9233.33%)
Mutual labels:  slider
Vue Glide
A slider and carousel as vue component on top of the Glide.js
Stars: ✭ 225 (+837.5%)
Mutual labels:  slider
react-instagram-zoom-slider
🌄↔️ A slider component with pinch to zoom capabilities inspired by Instagram
Stars: ✭ 67 (+179.17%)
Mutual labels:  slider
MediaSliderView
Pure java based, highly customizable media slider gallery supporting both images and videos for android.
Stars: ✭ 85 (+254.17%)
Mutual labels:  slider
Keen Slider
The HTML touch slider carousel with the most native feeling
Stars: ✭ 3,097 (+12804.17%)
Mutual labels:  slider

slider-card

ARCHIVED!!!

This repo is not being updated anymore. Find the updated cards here: https://github.com/AnthonMS/my-cards

This will be rolled back to have the cloud dependant version of the card.

Breaking changes in latest version!

The card is now named "my-slider". So you'll have to change this in your setup after installing the new version. The new version has made it so the card is not cloud dependant any longer. LitElement is compiled directly into the code now.

Description

Slider Card is a customizable card for light, input_number, covers, fans, switches, locks & media_player volume_level entity sliders, for the Home Assistant Lovelace frontend. Please read the notes at the bottom of this readme, there are some important styling tips, because the padding on the thumb works in mysterious ways (Using border styling)
Everything under function in the options table is css styling, so it is possible to use any of the supported ways of setting styles. For example for width, height and paddings you can use '%', 'px', 'rem' and so on. And the same for colors, you can use hex, rgb and named.

Features

  • Customizable slider card for lights, input_numbers, media_players, covers, fans, switches, and locks
  • It can handle both brightness and warmth of light
  • It can handle custom min, max and step for input_number
  • It will toggle switches and locks when slid (slide-to-unlock style)

Future features (Maybe)

  • Customizable Percentage Text inside slider.
  • Multiple entities (Right now you can only put one light entity in each card).
  • If you would like a new feature, please feel free to create an issue asking for it.

My Setup Using This

Example Setup

Demo

Example

Options

Name Type Default Description
type string Required custom:my-slider
entity string Required light.living_room
minBar int 0 Set minimum value slider bar will display for media_player, fan, and cover entities
maxBar int 100 Set maximum value slider bar will display for media_player, fan, and cover entities
minSet int 0 Set minimum value entity can change
maxSet int 100 Set maximum value entity can change
step string "1" Number of steps to take (For input number, if step is not specified, it will use step from attributes.) (For media_player, if step is not specified it will step by 0.01. (It will actually step by 1, but it will convert 27 to 0.27. So if you set a custom step, set it between 0 and 100.))
radius string "4px" Border radius of slider.
function string "Brightness" Function of the slider (Brightness/Warmth)
width string 100% Width of slider
height string 50px Height of slider
top string 0px Top position of slider
bottom string 0px Bottom position of slider
right string 0px Right position of slider
left string 0px Left position of slider
rotate string 0 Rotation in degrees. Just put 90, if you want to rotate it 90 degrees
containerHeight string 50px Height of container slider is in. This is used if you want vertical slider
mainSliderColor string var(--accent-color) Main color of slider
mainSliderColorOff string #636363 Main color of slider when inactive
secondarySliderColor string #4d4d4d Secondary color of slider
secondarySliderColorOff string #4d4d4d Secondary color of slider when inactive
thumbWidth string 25px Width of thumb
thumbHeight string 80px Height of thumb
thumbColor string #FFFFFF Color of thumb
thumbColorOff string #969696 Color of thumb when inactive
thumbHorizontalPadding string 10px Horizontal padding of the thumb
thumbVerticalPadding string 20px Vertical padding of thumb

Installation

HACS

  1. Add this repo to HACS
  2. Install
  3. Add something in the line of this to the configuration:
    - url: /hacsfiles/ha-slider-card/my-slider.js
      type: module

Manually

  1. Download my-slider.js located in dist/ directory
  2. Place it in your HA www/ directory
  3. Add something in the line of this to the configuration:
    - url: /local/my-slider.js
      type: module

Examples

Default

cards:
  - type: custom:my-slider
    entity: light.example

Adjust Warmth of Light

cards:
  - type: custom:my-slider
    entity: light.example
    function: "Warmth"

use for Input Number

cards:
  - type: custom:my-slider
    entity: input_number.example
cards:
  - type: custom:my-slider
    entity: input_number.example
    step: "10"

Default Slider Config

Change Slider Height and Colors

cards:
    - type: custom:my-slider
      entity: light.dinner_table_light
      height: '30px'
      mainSliderColor: 'green'
      secondarySliderColor: 'red'

Change Slider Height and Colors Config

Change Thumb Size and Colors

cards:
  - type: custom:my-slider
    entity: light.dinner_table_light
    height: '30px'
    mainSliderColor: 'blue'
    secondarySliderColor: 'darkblue'
    thumbWidth: '25px'
    thumbHeight: '60px'
    thumbColor: 'black'

Change Thumb Height and Colors Config

Change Thumb Padding and Size

cards:
###########  LEFT SLIDER  ############
  - type: custom:my-slider
    entity: light.dinner_table_light
    height: '30px'
    mainSliderColor: 'green'
    secondarySliderColor: 'red'
    thumbWidth: '0px'
    thumbHeight: '30px'
    thumbColor: 'pink'
    thumbHorizontalPadding: '0px'
    thumbVerticalPadding: '0px'

###########  RIGHT SLIDER  ############
  - type: custom:my-slider
    entity: light.sofa_light
    height: '30px'
    mainSliderColor: 'blue'
    secondarySliderColor: 'darkblue'
    thumbWidth: '5px'
    thumbHeight: '30px'
    thumbColor: 'black'
    thumbHorizontalPadding: '0px'
    thumbVerticalPadding: '0px'

Change Thumb Height and Colors Config

Change Active and Inactive Colors Config

cards:
  - type: custom:my-slider
    entity: light.dinner_table_light
    mainColor: red
    mainColorOff: darkred
    secondarySliderColor: blue
    secondarySliderColorOff: darkblue
    thumbColor: white
    thumbColorOff: black

Change Active and Inactive Colors Config

Using a Switch or Lock

By adjusting the maxSet you can adjust when a release causes the entity to be toggled. In this example the user would only need to slide 70% of the way to activate this lock

cards:
  - type: custom:my-slider
    entity: lock.lock
    maxSet: 70

Change Active and Inactive Colors Config

NOTE

When changing the padding of the thumb. If you want for example padding on the sides (horizontal) you will have to triple the width of the thumb itself, this has something to do with the border styling. There is possibly a way around this, if I use some more time on the styling, but for now, this will have to do, since it serves the purpose I need it for. Plus if you just keep this in mind, there should be no trouble. But play around with it. This includes when wanting padding on top/bottom (vertical), you will have to change height of the thumb.

For the colors, you can use HEX colors ('#111111'), color names supported by CSS ('red', 'blue', 'black', etc.) and I assume you can also use rgb ('rgb(255, 255, 255)') and rgba ('rgba(255, 255, 255, 0.5)'). rgba is used when you want to change the opacity, this is the last number in the comma seperated list, where 1 is full opacity and 0 is full transparency.

Setup Dev Environment

  1. Clone the repository down on your work PC.
  2. Run npm install in the project root directory.
  3. Serve it by running npm start
  4. Build it by running npm run build
  5. Add this to your Home Assistant Configuration (IP is the local IP of the machine you're hosting the card on):
    - url: http://<IP>:5000/my-slider.js?v=001
      type: module
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].