Skip to content
Back to skills

Canvas Component Utils

ASecurity

Import utilities from the `drupal-canvas` package: ```jsx import { FormattedText, Image } from "drupal-canvas"; ```

  • 225 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 4, 2026
development

Security analysis

A100/100

Pro scans all 13 files and shows the line behind each finding

Scanned September 4, 2026

npx -y skills add NeverSight/skills_feed --skill canvas-component-utils --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Canvas Component Utils?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Canvas Component Utils
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/neversight-canvas-component-utils/badge)](https://www.skillsdirectory.com/skills/neversight-canvas-component-utils)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: canvas-component-utils
description:
  Use utility components to render formatted text and media correctly. Use when
  (1) Rendering HTML text content from props, (2) Displaying images, (3) Working
  with formatted text or media. Covers FormattedText and Image utilities.
---

Import utilities from the `drupal-canvas` package:

```jsx
import { FormattedText, Image } from "drupal-canvas";
```

## FormattedText

Use `FormattedText` to render HTML content from props. This is required for any
prop with `contentMediaType: text/html` in component.yml.

```yaml
# component.yml
props:
  properties:
    text:
      title: Text
      type: string
      contentMediaType: text/html
      x-formatting-context: block
      examples:
        - <p>This is <strong>formatted</strong> text.</p>
```

```jsx
import { FormattedText } from "drupal-canvas";

const Text = ({ text, className }) => (
  <FormattedText className={className}>{text}</FormattedText>
);
```

**When to use FormattedText:**

- Props that accept rich text/HTML content
- Any prop with `contentMediaType: text/html`
- Content that may contain `<p>`, `<strong>`, `<em>`, `<a>`, or other HTML tags

**Do NOT use FormattedText for:**

- Plain text props (type: string without contentMediaType)
- Headings or titles (use regular elements)

## Image

Use `Image` for responsive image rendering. It handles responsive behavior and
optimization automatically.

```yaml
# component.yml
props:
  properties:
    image:
      title: Image
      type: object
      $ref: json-schema-definitions://canvas.module/image
      examples:
        - src: https://example.com/photo.jpg
          alt: Description of image
          width: 800
          height: 600
```

```jsx
import { Image } from "drupal-canvas";

const Card = ({ image }) => {
  const { src, alt, width, height } = image;
  return (
    <Image
      src={src}
      alt={alt}
      width={width}
      height={height}
      className="w-full rounded-lg object-cover"
    />
  );
};
```

**Image props:**

- `src` - Image URL (required)
- `alt` - Alt text for accessibility (required)
- `width` - Original image width
- `height` - Original image height
- `className` - Tailwind classes for styling

Files in this skill

  • SKILL.md2.2 KB
  • description_ar.txt338 B
  • description_cn.txt234 B
  • description_de.txt310 B
  • description_en.txt229 B
  • description_es.txt278 B
  • description_fr.txt304 B
  • description_it.txt348 B
  • description_ja.txt473 B
  • description_ko.txt333 B
  • description_ru.txt526 B
  • description_tw.txt234 B
  • stats.json65 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.