You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

checkbox.css 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* based on Fomantic UI checkbox module, with just the parts extracted that we use. If you find any
  2. unused rules here after refactoring, please remove them. */
  3. input[type="checkbox"],
  4. input[type="radio"] {
  5. width: var(--checkbox-size);
  6. height: var(--checkbox-size);
  7. }
  8. .ui.checkbox {
  9. position: relative;
  10. display: inline-block;
  11. vertical-align: baseline;
  12. min-height: var(--checkbox-size);
  13. line-height: var(--checkbox-size);
  14. min-width: var(--checkbox-size);
  15. padding: 1px;
  16. }
  17. .ui.checkbox input[type="checkbox"],
  18. .ui.checkbox input[type="radio"] {
  19. position: absolute;
  20. top: 0;
  21. left: 0;
  22. width: var(--checkbox-size);
  23. height: var(--checkbox-size);
  24. }
  25. .ui.checkbox input[type="checkbox"]:enabled,
  26. .ui.checkbox input[type="radio"]:enabled,
  27. .ui.checkbox label:enabled {
  28. cursor: pointer;
  29. }
  30. .ui.checkbox label {
  31. cursor: auto;
  32. position: relative;
  33. display: block;
  34. user-select: none;
  35. }
  36. .ui.checkbox label,
  37. .ui.radio.checkbox label {
  38. padding-left: 1.85714em;
  39. }
  40. .ui.checkbox + label {
  41. vertical-align: middle;
  42. }
  43. .ui.disabled.checkbox label,
  44. .ui.checkbox input[disabled] ~ label {
  45. cursor: default !important;
  46. opacity: 0.5;
  47. pointer-events: none;
  48. }
  49. .ui.radio.checkbox {
  50. min-height: var(--checkbox-size);
  51. }
  52. /* "switch" styled checkbox */
  53. .ui.toggle.checkbox {
  54. min-height: 1.5rem;
  55. }
  56. .ui.toggle.checkbox input {
  57. width: 3.5rem;
  58. height: 1.5rem;
  59. opacity: 0;
  60. z-index: 3;
  61. }
  62. .ui.toggle.checkbox label {
  63. min-height: 1.5rem;
  64. padding-left: 4.5rem;
  65. padding-top: 0.15em;
  66. }
  67. .ui.toggle.checkbox label::before {
  68. display: block;
  69. position: absolute;
  70. content: "";
  71. z-index: 1;
  72. top: 0;
  73. width: 3.5rem;
  74. height: 1.5rem;
  75. border-radius: 500rem;
  76. left: 0;
  77. }
  78. .ui.toggle.checkbox label::after {
  79. background: var(--color-white);
  80. position: absolute;
  81. content: "";
  82. opacity: 1;
  83. z-index: 2;
  84. width: 1.5rem;
  85. height: 1.5rem;
  86. top: 0;
  87. left: 0;
  88. border-radius: 500rem;
  89. transition: background 0.3s ease, left 0.3s ease;
  90. }
  91. .ui.toggle.checkbox input ~ label::after {
  92. left: -0.05rem;
  93. }
  94. .ui.toggle.checkbox input:checked ~ label::after {
  95. left: 2.15rem;
  96. }
  97. .ui.toggle.checkbox input:focus ~ label::before,
  98. .ui.toggle.checkbox label::before {
  99. background: var(--color-input-toggle-background);
  100. }
  101. .ui.toggle.checkbox label,
  102. .ui.toggle.checkbox input:checked ~ label,
  103. .ui.toggle.checkbox input:focus:checked ~ label {
  104. color: var(--color-text) !important;
  105. }
  106. .ui.toggle.checkbox input:checked ~ label::before,
  107. .ui.toggle.checkbox input:focus:checked ~ label::before {
  108. background: var(--color-primary) !important;
  109. }