🚀. Socket Launch Week Day 3:Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions.Learn more
Sign In

@limitless-angular/sanity

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@limitless-angular/sanity

A powerful Angular library for Sanity.io integration, featuring Portable Text rendering and optimized image loading.

Source
npmnpm
Version
18.1.0
Version published
Weekly downloads
1.1K
912.15%
Maintainers
1
Weekly downloads
 
Created
Source

@limitless-angular/sanity

This library provides Angular integrations for Sanity.io, enhancing your ability to work with Sanity content in Angular applications.

Demo

Check out our example project in the monorepo: apps/sanity-example

You can also see a live demo of the Sanity example here: Limitless Angular Sanity Example

Table of Contents

Getting Started

Installation

npm install --save @limitless-angular/sanity

Which Version to use?

Angular version@limitless-angular/sanity
>=18.0.018.x

Portable Text

A complete implementation for rendering Portable Text in Angular applications.

Basic Usage

import { Component } from '@angular/core';
import { PortableTextComponent, PortableTextComponents } from '@limitless-angular/sanity/portabletext';

@Component({
  selector: 'app-your-component',
  template: `<div portable-text [value]="portableTextValue" [components]="customComponents"></div> `,
  standalone: true,
  imports: [PortableTextComponent],
})
export class YourComponent {
  portableTextValue = [
    /* array of portable text blocks */
  ];
  customComponents: PortableTextComponents = {
    // optional object of custom components to use
  };
}

For more detailed information on using Portable Text, including styling, customizing components, and available components, please refer to the Portable Text README.

Image Loader

The image loader allows you to connect the NgOptimizedImage directive with Sanity to load images using the @sanity/image-url package.

Basic Usage

import { NgOptimizedImage } from '@angular/common';
import { SanityImageLoader } from '@limitless-angular/sanity/image-loader';

@Component({
  standalone: true,
  template: '<img ngSrc="image-id" width="100" height="100" />',
  imports: [NgOptimizedImage],
  providers: [
    provideSanityLoader({
      projectId: 'SANITY_PROJECT_ID',
      dataset: 'SANITY_DATASET',
    })
  ],
  // ...
})

For more details on the Image Loader, check out the Image Loader README.

Demo

Check out our example project in the monorepo: apps/sanity-example

Keywords

angular

FAQs

Package last updated on 12 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts