accordion.css 2.8 KB

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