accordion.css 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. [data-component="accordion"] {
  2. display: flex;
  3. flex-direction: column;
  4. align-items: flex-start;
  5. gap: 8px;
  6. align-self: stretch;
  7. [data-slot="accordion-item"] {
  8. width: 100%;
  9. display: flex;
  10. flex-direction: column;
  11. align-items: flex-start;
  12. align-self: stretch;
  13. overflow: clip;
  14. [data-slot="accordion-header"] {
  15. width: 100%;
  16. display: flex;
  17. align-items: center;
  18. margin: 0;
  19. padding: 0;
  20. [data-slot="accordion-trigger"] {
  21. width: 100%;
  22. display: flex;
  23. height: 32px;
  24. padding: 8px 12px;
  25. justify-content: space-between;
  26. align-items: center;
  27. align-self: stretch;
  28. cursor: default;
  29. user-select: none;
  30. background-color: var(--surface-base);
  31. border: 1px solid var(--border-weak-base);
  32. border-radius: var(--radius-md);
  33. overflow: clip;
  34. color: var(--text-strong);
  35. transition: background-color 0.15s ease;
  36. /* text-12-regular */
  37. font-family: var(--font-family-sans);
  38. font-size: var(--font-size-small);
  39. font-style: normal;
  40. font-weight: var(--font-weight-regular);
  41. line-height: var(--line-height-large); /* 166.667% */
  42. letter-spacing: var(--letter-spacing-normal);
  43. &:hover {
  44. background-color: var(--surface-base);
  45. }
  46. &:focus-visible {
  47. outline: none;
  48. }
  49. &[data-disabled] {
  50. cursor: not-allowed;
  51. }
  52. }
  53. }
  54. &[data-expanded] {
  55. [data-slot="accordion-trigger"] {
  56. border-bottom-left-radius: 0;
  57. border-bottom-right-radius: 0;
  58. }
  59. [data-slot="accordion-content"] {
  60. border: 1px solid var(--border-weak-base);
  61. border-top: none;
  62. border-bottom-left-radius: var(--radius-md);
  63. border-bottom-right-radius: var(--radius-md);
  64. }
  65. }
  66. [data-slot="accordion-content"] {
  67. overflow: hidden;
  68. width: 100%;
  69. }
  70. }
  71. }
  72. @keyframes slideDown {
  73. from {
  74. height: 0;
  75. }
  76. to {
  77. height: var(--kb-accordion-content-height);
  78. }
  79. }
  80. @keyframes slideUp {
  81. from {
  82. height: var(--kb-accordion-content-height);
  83. }
  84. to {
  85. height: 0;
  86. }
  87. }