← 一覧へ

Accordion / 010 — ミニマリスト|Minimalist

デザイン見本

  • Clean and minimal design
  • Subtle animations
  • Professional appearance

極限まで装飾を削ぎ落としたミニマリストデザイン。 細いラインとタイポグラフィの余白を生かした構成で、ポートフォリオや洗練されたブランドサイトにマッチします。

実装コード

HTML
<div class="container">
    <div class="btn-box">
        <button data-default-text="Minimalist Accordion" data-open-text="Close">Minimalist Accordion</button>
    </div>
    <div class="more">
        <ul>
            <li>Clean and minimal design</li>
            <li>Subtle animations</li>
            <li>Professional appearance</li>
        </ul>
    </div>
</div>
CSS
/* アニメーション定義 */
@keyframes acc10-fadeIn {
    0% {
        opacity: 0;
        transform: translateY(-5px)
    }
    100% {
        opacity: 1;
        transform: none
    }
}

.container {
    width: 100%;
}

.container .btn-box button {
    width: 100%;
    padding: 16px 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    font-size: 15px;
    font-weight: 400;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    position: relative;
    letter-spacing: -0.02em;
}

.container .btn-box button::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: #333;
    transition: width 0.3s ease;
    width: 0;
}

.container .btn-box button::after {
    content: '+';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
    font-weight: 300;
    color: #666;
    transition: all 0.3s ease;
}

.container .btn-box button:hover::before {
    width: 100%;
}

.container .more {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
}

.container .more.appear {
    max-height: 200px;
    animation: acc10-fadeIn 0.3s ease;
    margin-top: -1px;
}

.container:has(.more.appear) .btn-box button::after {
    transform: translateY(-50%) rotate(45deg);
}

.container .more ul {
    list-style: none;
    padding: 12px 0;
    margin: 0;
}

.container .more li {
    padding: 10px 0;
    color: #666;
    font-size: 14px;
    border-bottom: 1px solid #f5f5f5;
}

.container .more li:last-child {
    border-bottom: none;
}
JS
document.addEventListener("DOMContentLoaded", () => {
    document.querySelectorAll('.container').forEach(container => {
        const button = container.querySelector('.btn-box button');
        const content = container.querySelector('.more');
        
        if (button && content) {
            button.addEventListener('click', function() {
                content.classList.toggle('appear');
                
                // ボタンテキストの切り替え
                if (content.classList.contains('appear')) {
                    this.textContent = this.dataset.openText || 'Close';
                } else {
                    this.textContent = this.dataset.defaultText;
                }
            });
        }
    });
});