@contentstack/ui-extensions-sdk

中文文档
2.2.3发布于 2023/08/21MITCommonJS近 30 天下载 3248

The Extensions SDK allows you to extend Contentstack’s UI by helping you create Custom Fields, Custom Widgets, and Dashboard Widgets.

原始使用文档
文档目录8 节
  1. Getting started
  2. Extensions examples
  3. Custom Fields
  4. Custom Widgets
  5. Dashboard Widgets
  6. Using Contentstack styles
  7. More information
  8. License

Contentstack Extensions SDK

The Extensions SDK allows you to extend Contentstack’s UI by helping you create Custom Fields, Custom Widgets, and Dashboard Widgets.

Custom Fields enable users to introduce simpler interface controls, such as color picker, code editor, video selector, and more, or maybe complex micro web applications such as Shopify or Snipkart. Because of their dissociated nature, custom fields can be reused multiple times.

Custom Widgets are like micro content-processing apps that help you analyze the entry content and provide recommendations. Some of the useful widgets you can create using this type of extension are text intelligence, SEO recommendations, language translation, grammar checker and more.

Dashboard Widgets let you add powerful widgets to the stack’s dashboard that let users do more from a centralized location. Some examples of this type of extension include personal notes, recently published content, notification centre, and stack usage summary.

This SDK overview document introduces you to the concept of custom extensions.

Getting started

Include the compiled version of the extension client library by adding the following line to your application.

<script
    src="https://unpkg.com/@contentstack/[email protected]/dist/ui-extension-sdk.js"
    integrity="sha512-LMktiFAj7j/AUFctMlgY8qmLrLIQVctwwCsnCXIWnvgF9JlanilvFbZxOCtPNB5eO3vp2Nhw9ED1UsWa+ltSvQ=="
    crossorigin="anonymous"
></script>

Extensions examples

Custom Fields

Some of the examples of custom field extensions are:

  • Color Picker - Displays a native color picker polyfill that allows users to select color as input value and saves the color code in the backend

  • Ace Editor - Displays a code editor written in JavaScript, allowing you to edit HTML, PHP, JavaScript and more easily

  • JSON Editor - Displays a simple editor that lets you view, edit and format JSON code within the field of your content type

  • Key-value Field - Lets you add key-value as input value of a field of your content type

  • Progress Bar - Allows users to set value of a field by sliding the progress bar to the left or right

  • Star Ratings - Lets you provide rating by choosing number of stars

  • Brightcove - Lets you fetch and display your Brightcove videos into a field of your content type.

  • Shopify - Lets you load products of your Shopify store into the field of your content type.

  • Egnyte - Allows you to fetch files of your Egnyte account and display them into a field of your content type.

  • Ooyala - Lets you fetch and display your Ooyala videos into a field of your content type.

  • Optimizely - Lets you serve personalized content by allowing you to select the audience for each entry.

  • Youtube - Lets you fetch and display your Youtube videos into a field of your content type.

  • External API Lookup - Lets you fetch data from an external API and display the data as possible values for the field on an entry page in Contentstack.

Custom Widgets

Some of the examples of custom widget extensions are:

  • Text Intelligence - Lets you use MonekyLearn APIs to provide helpful recommendations such as content summarizer, keyword extractor, retail classifier, etc.

  • Google Analytics - Displays the traffic analysis and statistics of your entry (using Google Analytics data) on the sidebar of the entry.

  • Optimizely Experiments - Lets you retrieve and display Optimizely Experiments and their details in your entry.

  • Developer Tools - This widget extension provides developers with quick tools (API endpoint, JSON, etc.) to work with an entry or all entries of a content type and do a lot more.

Dashboard Widgets

Some of the examples of the dashboard widget extensions are:

  • Google Analytics - Displays the traffic analysis and statistics of your site on the stack dashboard.

  • Content Type Visualizer - Content Type Visualizer Dashboard Widget offers a graphical representation of all content types, along with their fields, in a particular stack.

Using Contentstack styles

Extensions are rendered within an iframe, you will need to include the ui-extension-sdk.min.css library within your custom extension in order to use any of the styles provided by Contentstack.

Include the CSS file in your extension code as follows:

<link
    rel="stylesheet"
    type="text/css"
    href="https://unpkg.com/@contentstack/ui-extensions-sdk/dist/ui-extension-sdk.css"
    integrity="sha512-yPPI/jWiqPr0HIh+1A2QPP5p58sSYqbPoBykxIuBckT1vzGwNbrOmwYM03qGI4ffnxd7q4kkoDys0kdZzxYn9A=="
    crossorigin="anonymous"
/>

For more information on styling your extension, refer to our style guide.

More information

License

Licensed under MIT.

版本与发布记录

@contentstack/ui-extensions-sdk 共发布 13 个版本,首次发布于 2019/04/05;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.2.3latest2023/08/213 年前
2.2.22023/08/213 年前
2.2.12022/08/014 年前
2.2.02020/04/246 年前
2.1.22019/12/116 年前
2.1.12019/11/246 年前

关于 @contentstack/ui-extensions-sdk 的常见问题

@contentstack/ui-extensions-sdk 是什么?

The Extensions SDK allows you to extend Contentstack’s UI by helping you create Custom Fields, Custom Widgets, and Dashboard Widgets.

如何安装 @contentstack/ui-extensions-sdk?

在项目目录运行 npm install @contentstack/ui-extensions-sdk,或使用 pnpm add / yarn add / bun add。

@contentstack/ui-extensions-sdk 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/contentstack__ui-extensions-sdk 是否存在。

@contentstack/ui-extensions-sdk 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@contentstack/ui-extensions-sdk 可以商用吗?

@contentstack/ui-extensions-sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@contentstack/ui-extensions-sdk 的下载量有多少?

根据 npm 官方下载统计,@contentstack/ui-extensions-sdk 在 2026/10/11 – 2026/11/09 这 30 天内被下载 3,248 次,日均约 108 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@contentstack/ui-extensions-sdk 还在维护吗?

最新版本 2.2.3 发布于 2023/08/21(3 年前);至今共发布 13 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/04/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。