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 的最新消息。

➞ 所有新闻
更多详情