@gemeente-denhaag/file

中文文档
2.7.0发布于 2026/11/09EUPL-1.2TypeScriptESM + CJS构建来源已验证近 30 天下载 1.2万

A file displays a link to download an attachment and metadata about the file.

原始使用文档
文档目录15 节
  1. When to use
  2. Alternatives and related components
  3. Anatomy
  4. (Interactive) states
  5. Design properties
  6. Typography
  7. Color
  8. Interactive states
  9. Structure
  10. Accessibility
  11. Content guidelines
  12. Best practices
  13. Dos
  14. Don’ts
  15. References

File

npm version

A file displays a link to download an attachment and shows metadata about the file.

When to use

A file is used to present and download a file that is uploaded by the user or an employee.

None.

Anatomy

The file consists of:

  1. File name: the name of the file
  2. Preview: shows an icon of the type of the file (e.g. document, image)
  3. Navigational link: shows the download option
  4. Container

(Interactive) states

The file contains the states normal, hover and focus.

Design properties

Typography

  • File name: TheSans/md/400

Color

  • File name: text color Grey/4
  • Preview: icon svg color Grey/4, border color Grey/2
  • Container: border color Grey/2

Interactive states

  • Hover: title text color Blue/3, icon svg color Blue/3, container background-color warm/grey
  • Focus: title text color Grey/4, icon svg color Grey/4, container border color Ocher/5

Structure

  • File name: padding-left and padding-right 16px
  • Preview: icon size 24px, icon padding 16px
  • Navigational link: padding-left and padding-right 16px
  • Container: min-height 56px, padding-top and padding-bottom 16px, margin-bottom 16px, border 1px

Mobile

  • File name: padding-bottom 8px, padding-left and padding-right 16px
  • Navigational link: padding-left 16px
  • Preview: icon size 24px, icon padding-left and padding-right 16px
  • Container: padding-top and padding-bottom 12px

Accessibility

In order to comply with accessibility standards you should not force a file to open in a new tab. It must be left up to the user to decide whether to download a file, or open in a new tab.

The one exception to this rule is in forms as there are often challenges around caching user data. When ns-download is used within ns-form; if the browser can display the file type it will open in a new tab.

Content guidelines

None.

Best practices

Dos

Files download should:

  • Be used for all downloads.
  • Include file size and type. Showing the file size is particularly nice for users that are on reduced data allowences (i.e. mobile), and also offers an indication on how long a file might take to download.

Don’ts

Files download should:

  • Not be described as a file.

References

https://ons-design-system.netlify.app/components/downloads/

版本与发布记录

@gemeente-denhaag/file 共发布 121 个版本,首次发布于 2023/09/07;过去 12 个月发布了 12 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.7.0latest2026/11/096 天前
2.6.02026/10/051 个月前
2.5.32026/09/231 个月前
2.5.22026/08/272 个月前
2.5.12026/07/273 个月前
2.5.02026/06/294 个月前

关于 @gemeente-denhaag/file 的常见问题

@gemeente-denhaag/file 是什么?

A file displays a link to download an attachment and metadata about the file.

如何安装 @gemeente-denhaag/file?

在项目目录运行 npm install @gemeente-denhaag/file,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(18 || 19)、react-dom(18 || 19)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@gemeente-denhaag/file 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@gemeente-denhaag/file 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@gemeente-denhaag/file 可以商用吗?

@gemeente-denhaag/file 使用 EUPL-1.2 许可。声明的许可为 EUPL-1.2,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@gemeente-denhaag/file 的下载量有多少?

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

@gemeente-denhaag/file 还在维护吗?

最新版本 2.7.0 发布于 2026/11/09(6 天前);至今共发布 121 个版本,其中过去 12 个月发布了 12 个;首次发布于 2023/09/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。