Bento

Bento 是一個易於使用的元件庫,可協助您達成優異的網頁體驗。

Supported frameworks

Bento 與架構和 CMS 完美搭配

Bento 元件打包成 React 或 Preact 元件,能與這些架構無縫整合,但它們也提供為 Web 元件形式,以便在其他地方使用。

架構指南
Bento features

Bento 帶來的絕佳網頁體驗

為使用者提供絕佳體驗非常重要,而 Bento 元件從一開始便考量到網頁體驗而設計。例如,所有 Bento 元件都會減少內容位移,進而避免使用者感到困擾。

開始學習

Bento 的實際運用

Bento 元件高度可自訂,並可透過 API 實現自訂互動性。

➞ 所有元件
<bento-base-carousel id="my-carousel">
<img src="/assets/img/group-1.webp" />
<img src="/assets/img/group-2.webp" />
<img src="/assets/img/group-3.webp" />
</bento-base-carousel>

<script>
(async () => {
const carousel = document.querySelector('#my-carousel');
await customElements.whenDefined('bento-base-carousel');
const api = await carousel.getApi();

// programatically advance to next slide
api.next();
})();
</script>
<bento-accordion id="my-accordion">
<section>
<h2>Section 1</h2>
<p>Content in section 1.</p>
</section>
<section>
<h2>Section 2</h2>
<p>Content in section 2.</p>
</section>
<section>
<h2>Section 3</h2>
<p>Content in section 3.</p>
</section>
</bento-accordion>
<script>
(async () => {
await customElements.whenDefined('bento-accordion');
const api = await accordion.getApi();
const accordion = document.querySelector('#my-accordion');
})();
</script>
<bento-sidebar id="sidebar1" side="right" hidden>
<h2>Navigation Sidebar</h2>
<ul>
<li>Nav item A</li>
<li>Nav item B</li>
<li>Nav item C</li>
<li>Nav item D</li>
</ul>
</bento-sidebar>

<div class="buttons">
<button id="open-sidebar">Open sidebar</button>
</div>

<script>
(async () => {
await customElements.whenDefined('bento-sidebar');
const api = await sidebar.getApi();
const sidebar = document.querySelector('#sidebar1');
document.querySelector('#open-sidebar').onclick = () => api.open();
})();
</script>
<bento-social-share
id="my-share"
type="twitter"
aria-label="Share on Twitter"
>
</bento-social-share>

<button id="change-share">Change share button</button>

<script>
(async () => {
const socialShare = document.querySelector('#my-share');
const changeShareButton = document.querySelector('#change-share');
changeShareButton.onclick = () => {
socialShare.setAttribute('type', 'linkedin');
socialShare.setAttribute('aria-label', 'Share on LinkedIn');
};
})();
</script>

最新消息

查看有關 Bento 的最新消息。

➞ 所有新聞
更多資訊