Code Monkey home page Code Monkey logo

react-imgix's Introduction

imgix logo

react-imgix provides custom components for integrating imgix into React sites and generating images server-side.

npm version Build Status Downloads License styled with prettier All Contributors FOSSA Status


Overview / Resources

Before you get started with react-imgix, it's highly recommended that you read Eric Portis' seminal article on srcset and sizes. This article explains the history of responsive images in responsive design, why they're necessary, and how all these technologies work together to save bandwidth and provide a better experience for users. The primary goal of react-imgix is to make these tools easier for developers to implement, so having an understanding of how they work will significantly improve your react-imgix experience.

Below are some other articles that help explain responsive imagery, and how it can work alongside imgix:

Installation

  • NPM: npm install react-imgix
  • Yarn: yarn add react-imgix

This module exports two transpiled versions. If a ES6-module-aware bundler is being used to consume this module, it will pick up an ES6 module version and can perform tree-shaking. If you are not using ES6 modules, you don't have to do anything

Usage

import Imgix from "react-imgix";

// in react component
<Imgix src={string} />;

Examples

Basic Use Case

For simply using as you would use an <img>, react-imgix can be used as follows:

import Imgix from "react-imgix";

<Imgix src="https://assets.imgix.net/examples/pione.jpg" sizes="100vw" />;

Edit xp0348lv0z

Please note: 100vw is an appropriate sizes value for a full-bleed image. If your image is not full-bleed, you should use a different value for sizes. Eric Portis' "Srcset and sizes" article goes into depth on how to use the sizes attribute.

This will generate HTML similar to the following:

<img
  src="https://assets.imgix.net/examples/pione.jpg?auto=format&crop=faces&ixlib=react-7.2.0"
  sizes="100vw"
  srcset="
    https://assets.imgix.net/examples/pione.jpg?auto=format&crop=faces&ixlib=react-7.2.0&w=100 100w,
    https://assets.imgix.net/examples/pione.jpg?auto=format&crop=faces&ixlib=react-7.2.0&w=200 200w,
    ...
  "
/>

Since imgix can generate as many derivative resolutions as needed, react-imgix calculates them programmatically, using the dimensions you specify. All of this information has been placed into the srcset and sizes attributes.

Width and height known and fixed: If the width and height are known beforehand, and a fixed-size image is wanted, it is recommended that they are set explicitly:

import Imgix from "react-imgix";

<Imgix
  src="https://assets.imgix.net/examples/pione.jpg"
  width={100} // This sets what resolution the component should load from the CDN and the size of the resulting image
  height={200}
/>;

Edit xp0348lv0z

When width and height are specified, <Imgix> will give the image a srcset with resolution descriptors.

Width and height known but fluid: If the image's intrinsic width and height are known but a fluid size image is wanted, width and height should still be set to avoid layout shift, but they must be set via htmlAttributes so as not to hint to <Imgix> to produce resolution descriptors in the srcset.

import Imgix from "react-imgix";

<Imgix
  src="https://assets.imgix.net/examples/pione.jpg"
  sizes="(min-width: 1024px) 40vw, 90vw"
  htmlAttributes={{ // These are ignored by Imgix but passed through to the <img> element
    width: 200,
    height: 100,
  }}
/>;

In this example, <Imgix> will produce a srcset with width descriptors.

Server-Side Rendering

Note This library does not run in Server Components but instead adds the "use client" directive to components. This means they are able to be used alongside Server Components (for example, as children), but they still require client-side JavaScript. Client Components are still SSRed.

React-imgix also works well on the server. Since react-imgix uses srcset and sizes, it allows the browser to render the correctly sized image immediately after the page has loaded. If they are known, pass width and height attributes via htmlAttributes to help combat layout shift.

import Imgix from "react-imgix";

<Imgix
  src="https://assets.imgix.net/examples/pione.jpg"
  sizes="100vw"
  htmlAttributes={{
    width: 400,
    height: 250,
  }}
/>;

If the width and height are known beforehand, and a fixed-size image is wanted, set width and height and do not set sizes:

import Imgix from "react-imgix";

<Imgix
  src="https://assets.imgix.net/examples/pione.jpg"
  width={100} // This sets what resolution the component should load from the CDN and the size of the resulting image
  height={200}
/>;

Flexible Image Rendering

This component acts dynamically by default. The component will leverage srcset and sizes to render the right size image for its container. This is an example of this responsive behaviour.

sizes should be set properly for this to work well, and some styling should be used to set the size of the component rendered. Without sizes and correct styling the image might render at full-size.

./styles.css

.App {
  display: flex;
}

.App > img {
  margin: 10px auto;
  width: 10vw;
  height: 200px;
}

./app.js

import "./styles.css";

<div className="App">
  <Imgix
    src="https://assets.imgix.net/examples/pione.jpg"
    sizes="calc(10% - 10px)"
  />
</div>;

Edit cold-wave-4qfhe

Aspect Ratio: A developer can pass a desired aspect ratio, which will be used when generating srcsets to resize and crop your image as specified. For the ar parameter to take effect, ensure that the fit parameter is set to crop.

<div className="App">
  <Imgix
    src="https://assets.imgix.net/examples/pione.jpg"
    sizes="calc(10% - 10px)"
    imgixParams={{ ar: "16:9" }}
  />
</div>

The aspect ratio is specified in the format width:height. Either dimension can be an integer or a float. All of the following are valid: 16:9, 5:1, 1.92:1, 1:1.67.

Fixed Image Rendering (i.e. non-flexible)

If the fluid, dynamic nature explained above is not desired, the width and height can be set explicitly.

import Imgix from "react-imgix";

<Imgix
  src="https://assets.imgix.net/examples/pione.jpg"
  width={100} // This sets what resolution the component should load from the CDN and the size of the resulting image
  height={200}
/>;

Fixed image rendering will automatically append a variable q parameter mapped to each dpr parameter when generating a srcset. This technique is commonly used to compensate for the increased filesize of high-DPR images. Since high-DPR images are displayed at a higher pixel density on devices, image quality can be lowered to reduce overall filesize without sacrificing perceived visual quality. For more information and examples of this technique in action, see this blog post. This behavior will respect any overriding q value passed in via imgixParams and can be disabled altogether with the boolean property disableQualityByDPR.

<Imgix
  src="https://domain.imgix.net/image.jpg"
  width={100}
  disableQualityByDPR
/>

will generate the following srcset:

https://domain.imgix.net/image.jpg?q=75&w=100&dpr=1 1x,
https://domain.imgix.net/image.jpg?q=50&w=100&dpr=2 2x,
https://domain.imgix.net/image.jpg?q=35&w=100&dpr=3 3x,
https://domain.imgix.net/image.jpg?q=23&w=100&dpr=4 4x,
https://domain.imgix.net/image.jpg?q=20&w=100&dpr=5 5x

Edit 4z1rzq04q7

Background Mode

Images can be rendered as a background behind children by using <Background />. The component will measure the natural size of the container as determined by the CSS on the page, and will render an optimal image for those dimensions.

Example:

// In CSS
.blog-title {
  width: 100vw;
  height: calc(100vw - 100px);
}

// In Component (React)
import { Background } from 'react-imgix'

<Background src="https://.../image.png" className="blog-title">
  <h2>Blog Title</h2>
</Background>

This component shares a lot of props that are used in the main component, such as imgixParams, and htmlAttributes.

As the component has to measure the element in the DOM, it will mount it first and then re-render with an image as the background image. Thus, this technique doesn't work very well with server rendering. If you'd like for this to work well with server rendering, you'll have to set a width and height manually.

Set width and height:

Setting the width and/or height explicitly is recommended if you already know these beforehand. This will save the component from having to do two render passes, and it will render a background image immediately.

This is accomplished by passing w and h as props to imgixParams.

<Background
  src="https://.../image.png"
  imgixParams={{ w: 1920, h: 500 }}
  className="blog-title"
>
  <h2>Blog Title</h2>
</Background>

Picture Support

Using the picture element you can create responsive images:

import Imgix, { Picture, Source } from "react-imgix";

<Picture>
  <Source
    src={src}
    width={400}
    htmlAttributes={{ media: "(min-width: 768px)" }}
  />
  <Source
    src={src}
    width={200}
    htmlAttributes={{ media: "(min-width: 320px)" }}
  />
  <Imgix src={src} imgixParams={{ w: 100 }} />
</Picture>

In order to reduce the duplication in props, JSX supports object spread for props:

import Imgix, { Picture, Source } from "react-imgix";

const commonProps = {
  src: "https://...",
  imgixParams: {
    fit: "crop",
    crop: "faces",
  },
};

<Picture>
  <Source
    {...commonProps}
    width={400}
    htmlAttributes={{ media: "(min-width: 768px)" }}
  />
  <Source
    {...commonProps}
    width={200}
    htmlAttributes={{ media: "(min-width: 320px)" }}
  />
  <Imgix src={src} width={100} />
</Picture>

A warning is displayed when no fallback image is passed. This warning can be disabled in special circumstances. To disable this warning, look in the warnings section.

ImgixProvider Component

The <ImgixProvider> Higher Order Component (HOC), makes its props available to any nested <Imgix> component in your React application.

For example, by rendering <ImgixProvider> at the top level of your application with imgixParams defined, all your <Imgix> components will have access to the same imgixParams.

import React from "react";
import Imgix, { ImgixProvider } from "react-imgix";
import HomePage from "./components/HomePage";

function App() {
  return (
    <div className="App">
      <header className="App-header">
        <ImgixProvider imgixParams={{ ar: "16:9", fit: "crop" }}>
          <div className="intro-blurb">{/* ... */}</div>
          <div className="gallery">
            <Imgix src="https://assets.imgix.net/examples/pione.jpg" />
            <Imgix src="https://sdk-test.imgix.net/ساندویچ.jpg" />
          </div>
        </ImgixProvider>
      </header>
    </div>
  );
}

export default App;

So that the generated HTML looks something like

<div class="gallery">
  <img
    src="https://assets.imgix.net/examples/pione.jpg?auto=format&ar=16%3A9&fit=crop"
    ...
  />
  <img
    src="https://sdk-test.imgix.net/%D8%B3%D8%A7%D9%86%D8%AF%D9%88%DB%8C%DA%86.jpg?auto=format&ar=16%3A9&fit=crop"
    ...
  />
</div>

You can take advantage of this behavior to use partial URLs with the <Imgix> component. By defining the domain prop on the Provider, it can be made accessible to all nested <Imgix> components.

// inside App.jsx
{
  /*... */
}
<ImgixProvider domain="assets.imgix.net">
  <div className="intro-blurb">{/* ... */}s</div>
  <div className="gallery">
    <Imgix src="/examples/pione.jpg" />
    <Imgix src="Office Background 1.png" />
  </div>
</ImgixProvider>;
{
  /*... */
}

Both the <Imgix> components above will access to the domain prop from the provider and have their relative src paths resolve to the same domain. So that the generated HTML looks something like:

<div class="gallery">
  <img src="https://assets.imgix.net/examples/pione.jpg" ... />
  <img
    src="https://assets.imgix.net/Office%20Background%201.png?auto=format"
    ...
  />
</div>

The props that <ImgixProvider> makes accessible can also be overridden by <Imgix> components. Any prop defined on the <Imgix> component will override the value set by the Provider.

// inside App.jsx
{
  /*... */
}
<ImgixProvider imgixParams={{ ar: "16:9", fit: "crop" }}>
  <div className="intro-blurb">{/* ... */}s</div>
  <div className="gallery">
    <Imgix
      imgixParams={{ ar: "4:2" }}
      src="https://assets.imgix.net/examples/pione.jpg"
    />
    <Imgix src="https://sdk-test.imgix.net/ساندویچ.jpg" />
  </div>
</ImgixProvider>;
{
  /*... */
}

So that the generated HTML looks something like this

<div class="gallery">
  <img
    src="https://assets.imgix.net/examples/pione.jpg?auto=format&ar=4%3A2&fit=crop"
    ...
  />
  <img
    src="https://sdk-test.imgix.net/%D8%B3%D8%A7%D9%86%D8%AF%D9%88%DB%8C%DA%86.jpg?ar=16%3A9&fit=crop"
    ...
  />
</div>

To remove a shared prop from an <Imgix> component, the same prop can be set to undefined on the component itself.

// inside App.jsx
{
  /*... */
}
<ImgixProvider height={500}>
  <div className="intro-blurb">{/* ... */}s</div>
  <div className="gallery">
    <Imgix src="https://assets.imgix.net/examples/pione.jpg" />
    <Imgix height={undefined} src="https://sdk-test.imgix.net/ساندویچ.jpg" />
  </div>
</ImgixProvider>;
{
  /*... */
}

So that the generated HTML looks something like this:

<div class="gallery">
  <img src="https://assets.imgix.net/examples/pione.jpg?h=500" ... />
  <img
    src="https://sdk-test.imgix.net/%D8%B3%D8%A7%D9%86%D8%AF%D9%88%DB%8C%DA%86.jpg"
    ...
  />
</div>

You can nest ImgixProvider components to ensure that different consumers have different props.

For example to give Imgix components different props from Picture components, you can nest an ImgixProvider inside of another one.

The nested Provider will change the Context for the Picture component, essentially removing their access to the shared props provided by the root ImgixProvider.

import React from 'react'
import Imgix, { ImgixProvider, Picture, Source } from "react-imgix";
export default function simpleImage() {
  return (
    <div className="imgix-simple-api-example">
      {/* there props will be accessible to all the imgix components */}
      <ImgixProvider
        domain="assets.imgix.net"
        src="/examples/pione.jpg"
        imgixParams={{ fit: "crop" }}
      >
        <Imgix width={200} height={500} src="/examples/pione.jpg" />
        <Imgix domain="sdk-test.imgix.net" src="/ساندویچ.jpg" />
        <ImgixProvider
          {/* since we define a new provider here, the context is redefined for any child components */}
        >
          <Picture>
            {/* imgixParams prop is no longer defined here */}
            <Source
              width={100}
              htmlAttributes={{ media: "(min-width: 768px)" }}
            />
            <Source
              width={200}
              htmlAttributes={{ media: "(min-width: 800px)" }}
            />
            <Imgix src="/examples/pione.jpg" />
          </Picture>
        </ImgixProvider>
      </ImgixProvider>
    </div>
  )
}

Advanced Examples

General Advanced Usage

Although imgix is open to feature suggestions, we might not accept the feature if it is a very specific use case. The features below are examples of what we consider general advanced use cases. Our target here is to support 95% of all the usages of normal img, picture, and source elements.

If your desired feature falls outside this percentage, do not worry! You will probably still be able to achieve your feature with react-imgix's more powerful API: buildURL.

This library exposes a pure function, buildURL, for generating full imgix URLs given a base URL and some parameters.

import { buildURL } from "react-imgix";

buildURL("http://yourdomain.imgix.net/image.png", { w: 450, h: 100 }); // => http://yourdomain.imgix.net/image.png?auto=format&w=450&h=100&ixlib=react-x.x.x

The base URL may also contain query parameters. These will be overridden by any parameters passed in with the second parameter.

This feature can be used to create your own custom img elements, or for use with other image components, such as React-bootstrap's Image component.

The ixlib parameter may be disabled by: buildURL(<url>, <params>, { disableLibraryParam: true })

Passing Custom HTML Attributes

This library allows the developer to pass any attribute they like to the underlying DOM element with htmlAttributes.

For example, if the the developer would like to attach a custom onLoad callback to an img component:

<Imgix
  src="..."
  sizes="..."
  htmlAttributes={{
    onLoad: () => handleImgOnLoad,
  }}
/>

Lazy Loading

If you'd like to lazy load images, we recommend using lazysizes. In order to use react-imgix with lazysizes, you can simply tell it to generate lazysizes-compatible attributes instead of the standard src, srcset, and sizes by changing some configuration settings:

<Imgix
  className="lazyload"
  src="..."
  sizes="..."
  attributeConfig={{
    src: "data-src",
    srcSet: "data-srcset",
    sizes: "data-sizes",
  }}
/>

The same configuration is available for <Source /> components

NB: It is recommended to use the attribute change plugin in order to capture changes in the data-* attributes. Without this, changing the props to this library will have no effect on the rendered image.

Low Quality Image Placeholder Technique (LQIP)

If you'd like to use LQIP images, like before, we recommend using lazysizes. In order to use react-imgix with lazysizes, you can simply tell it to generate lazysizes-compatible attributes instead of the standard src, srcset, and sizes by changing some configuration settings, and placing the fallback image src in the htmlAttributes:

<Imgix
  className="lazyload"
  src="..."
  sizes="..."
  attributeConfig={{
    src: "data-src",
    srcSet: "data-srcset",
    sizes: "data-sizes",
  }}
  htmlAttributes={{
    src: "...", // low quality image here
  }}
/>

NB: If the props of the image are changed after the first load, the low quality image will replace the high quality image. In this case, the src attribute may have to be set by modifying the DOM directly, or the lazysizes API may have to be called manually after the props are changed. In any case, this behaviour is not supported by the library maintainers, so use at your own risk.

Attaching Ref to DOM Elements

A ref passed to react-imgix using <Imgix ref={handleRef}> will attach the ref to the <Imgix> instance, rather than the DOM element. It is possible to attach a ref to the DOM element that is rendered using htmlAttributes:

<Imgix htmlAttributes={{ ref: handleRef }}>

This works for Source and Picture elements as well.

Props

Shared Props (Imgix, Source)

These props are shared among Imgix and Source Components

src :: string, required

Usually in the form: https://[your_domain].imgix.net/[image]. Don't include any parameters.

domain :: string, optional

Required only when using partial paths as src prop for a component. IE, if src is "/images/myImage.jpg", then the domain prop needs to be defined.

For example:

<Imgix domain="assets.imgix.net" src="/examples/pione.jpg">
imgixParams :: object

imgix params to add to the image src.

For example:

<Imgix imgixParams={{ mask: "ellipse" }} />
sizes :: string

Specified the developer's expected size of the image element when rendered on the page. Similar to width. E.g. 100vw, calc(50vw - 50px), 500px. Highly recommended when not passing width or height. Eric Portis' "Srcset and sizes" article goes into depth on how to use the sizes attribute.

className :: string

className applied to top level component. To set className on the image itself see htmlAttributes.

height :: number

Force images to be a certain height.

width :: number

Force images to be a certain width.

disableSrcSet :: bool, default = false

Disable generation of variable width src sets to enable responsiveness.

disableLibraryParam :: bool

By default this component adds a parameter to the generated url to help imgix with analytics and support for this library. This can be disabled by setting this prop to true.

disablePathEncoding :: bool

By default this component encodes the url path in the src and srcSet. This can be disabled by setting this prop to true. For more information about how imgix path encoding works, please refer to the imgix/js-core docs.

htmlAttributes :: object

Any other attributes to add to the html node (example: alt, data-*, className).

onMounted :: func

Called on componentDidMount with the mounted DOM node as an argument.

attributeConfig :: object

Allows the src, srcset, and sizes attributes to be remapped to different HTML attributes. For example:

  attributeConfig={{
    src: 'data-src',
    srcSet: 'data-srcset',
    sizes: 'data-sizes'
  }}

This re-maps src to data-src, srcSet to data-srcset, etc.

disableQualityByDPR :: bool, default = false

Disable generation of variable q parameters when rendering a fixed-size image.

srcSetOptions :: object

Allows customizing the behavior of the srcset generation. Valid options are widths, widthTolerance, minWidth, maxWidth, and devicePixelRatios. See @imgix/js-core for documentation of these options.

Picture Props

className :: string

className applied to top level component. To set className on the image itself see htmlAttributes.

onMounted :: func

Called on componentDidMount with the mounted DOM node as an argument.

htmlAttributes :: object

Any other attributes to add to the html node (example: alt, data-*, className).

Background Props

src :: string, required

Usually in the form: https://[your_domain].imgix.net/[image]. Don't include any parameters.

imgixParams :: object

imgix params to add to the image src. This is also how width and height can be explicitly set. For more information about this, see the "Background" section above.

For example:

<Background imgixParams={{ mask: "ellipse" }} />
className :: string

className applied to top level component. To set className on the image itself see htmlAttributes.

disableLibraryParam :: bool

By default this component adds a parameter to the generated url to help imgix with analytics and support for this library. This can be disabled by setting this prop to true.

htmlAttributes :: object

Any other attributes to add to the html node (example: alt, data-*, className).

Global Configuration

Warnings

This library triggers some warnings under certain situations to try aid developers in upgrading or to fail-fast. These can sometimes be incorrect due to the difficulty in detecting error situations. This is annoying, and so there is a way to turn them off. This is not recommended for beginners, but if you are using custom components or other advanced features, it is likely you will have to turn them off.

Warnings can be turned off with the public config API, PublicConfigAPI, which is exported at the top-level.

// in init script/application startup
import { PublicConfigAPI } from "react-imgix";

PublicConfigAPI.disableWarning('<warningName>');

//... rest of app startup
React.render(...);

Warnings can also be enabled with PublicConfigAPI.enableWarning('<warningName>')

The warnings available are:

warningName Description
fallbackImage Triggered when there is no <img> or <Imgix> at the end of the children when using <Picture>. A fallback image is crucial to ensure the image renders correctly when the browser cannot match against the sources provided
sizesAttribute This library requires a sizes prop to be passed so that the images can render responsively. This should only turned off in very special circumstances.
invalidARFormat Warnings thrown when the ar imgix parameter is not passed in the correct format (w:h)

Upgrade Guides

8.x to 9.0

This release brings the react-imgix API more in-line with that of imgix's rendering service.

The largest change users will notice is that this project's component will no longer generate a default fit=crop parameter. The original intention behind this was that generated images would maintain aspect ratio when at least one of the dimensions were specified. However, the default imgix API behavior sets fit=clip, which is now reflected in this project. Although this may not cause breaking changes for all users, it can result in unusual rendered image behavior in some cases. As such, we would rather err on the side of caution and provide users the ability to opt in to these changes via a major release.

If you are currently relying on the default generation of fit=crop when rendering images, you will now have to manually specify it when invoking the component:

<Imgix
  src="https://assets.imgix.net/examples/pione.jpg"
  sizes="100vw"
  imgixParams={{ fit: "crop" }}
/>

The other major change relates to how the component determines an image's aspect ratio. Instead of appending a calculated height h= value based on specified dimensions, the URL string will now be built using the imgix aspect ratio parameter ar=. Luckily, the interface for specifying an aspect ratio is no different from before. However, users will have to pass in the fit=crop parameter in order for it to take effect:

<Imgix
  src="http://assets.imgix.net/examples/pione.jpg"
  width={400}
  imgixParams={{ ar: "2:1", fit: "crop" }}
/>

7.x to 8.0

This is a very large update to this library with a lot of breaking changes. We apologise for any issues this may cause, and we have tried to reduce the number of breaking changes. We have also worked to batch up all these changes into one release to reduce its impacts. We do not plan on making breaking changes for a while after this, and will be focussed on adding features.

The largest change in this major version bump is the move to width-based srcSet and sizes for responsiveness. This has a host of benefits, including better server rendering, better responsiveness, less potential for bugs, and performance improvements. This does mean that the old fitting-to-container-size behaviour has been removed. If this is necessary, an example of how this can be achieved can be found here

To upgrade to version 8, the following changes should be made.

  • A sizes prop should be added to all usages of <Imgix>. If sizes is new to you (or even if it's not), Eric's seminal article on srcset and sizes is highly recommended.

  • Change all usages of type='picture' to <Picture> and type='source' to <Source>

    // this...
    <Imgix type='picture'>
      <Imgix type='source' src={src}>
      <Imgix type='source' src={src}>
    </Imgix>
    
    // becomes...
    <Picture>
      <Source src={src}>
      <Source src={src}>
    </Picture>

    See Picture support for more information.

  • Remove all usage of type='bg' as it is no longer supported. It was decided that it was too hard to implement this feature consistently. If you would still like to use this feature, please give this issue a thumbs up: #160 If we get enough requests for this, we will re-implement it.

  • Remove props aggressiveLoad, component, fluid, precision as they are no longer used.

  • Change all usages of defaultHeight and defaultWidth to width and height props.

  • Rename generateSrcSet to disableSrcSet and invert the value passed down as the prop's value. i.e. generateSrcSet={false} becomes disableSrcSet={true} or simply disableSrcSet

  • If support is needed for a browser which does not support the new usage of srcSet (such as IE 11), we recommended adding a polyfill, such as the great Picturefill.

Browser Support

  • By default, browsers that don't support srcset, sizes, or picture will gracefully fall back to the default img src when appropriate. If you want to provide a fully-responsive experience for these browsers, react-imgix works great alongside Picturefill!
  • We support the latest version of Google Chrome (which automatically updates whenever it detects that a new version of the browser is available). We also support the current and previous major releases of desktop Firefox, Internet Explorer, and Safari on a rolling basis. Mobile support is tested on the most recent minor version of the current and previous major release for the default browser on iOS and Android (e.g., iOS 9.2 and 8.4). Each time a new version is released, we begin supporting that version and stop supporting the third most recent version.

This browser support is made possible by the great support from BrowserStack.

Contributors

Thanks goes to these wonderful people (emoji key):


Frederick Fogerty

💻 📖 🚧 💬

sherwinski

💻 📖 🚧 💬

Jason Eberle

💻 📖 🚧 💬

Paul Straw

🚧

Kelly Sutton

🚧

Richard Bliss

💻 ⚠️

Eric Koslow

💻 📖

Baldur Helgason

💻

jonathan schatz

💻

Theo

💻

Tanner Stirrat

💻 🐛

Nicholas Suski

💻

voiceup

💻

Craig Kochis

💻

Dennis Schaaf

💻

Andy Kent

💻

Gabby Losch

💻

Stephen Cook

💻 🐛

Eugene Nagorny

📖

Samuel Giles

📖

Espen Hovlandsdal

📖

Daniel Farrell

📖

Luiz Fernando da Silva Cieslak

📖

Nick Gottlieb

📖

Pierre Grimaud

📖

Luis H. Ball Jr.

💻

This project follows the all-contributors specification. Contributions of any kind welcome, but please review the contribution guidelines before getting started!

Meta

React-imgix was originally created by Frederick Fogerty. It's licensed under the ISC license (see the license file for more info).

FOSSA Status

react-imgix's People

Contributors

allcontributors[bot] avatar arno-fukuda avatar baldurh avatar cecchi avatar dependabot[bot] avatar ekosz avatar ericdeansanchez avatar fossabot avatar frederickfogerty avatar greenkeeperio-bot avatar heyitsbryanm avatar kellysutton avatar longevitytina avatar luqven avatar minfawang avatar modosc avatar nickhavenly avatar paulstraw avatar pgrimaud avatar rbliss avatar renovate-bot avatar renovate[bot] avatar samuelgiles avatar semantic-release-bot avatar sherwinski avatar stephencookdev avatar theolampert avatar tstirrat15 avatar val3ntin avatar vinceprofeta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-imgix's Issues

Add use case examples to docs

type: suggestion

Most of the time, the combinations of props that should be used to support a particular use case is not clear. There should be some examples of common use cases to help users find the combination of props that will work for their use case.

Use cases:

  • Basic use case
  • Server-side rendering (see #139)
  • Flexible image rendering (similar to basic but explained more)
  • Fixed image rendering (i.e. non-flexible)
  • Picture support
  • Background mode (contain v not-contain)
  • Custom components
  • Some common crop or other prop uses

Add some usage examples to readme

It would be helpful to have some different examples, for instance, no cropping, entropy cropping, face cropping, background mode, image mode, etc.

New version

Hi, do you mind publishing a new version containing 4034663.

I'm seeing a lot of errors from Object.assign, and I believe they are from this component.

Add ixlib parameter to URLs to support debugging from Imgix team

Before you submit:

Is your feature request related to a problem? Please describe.
It's hard to debug issues from the Imgix side without knowing what library requests come from, and what version the library is using

Describe the solution you'd like

  • Add a query parameter to urls, and turn on by default: ?ixlib=react-1.0.0.
  • There should be an option to turn this off - disableLibraryParam
  • There should also be an example added to show how to disable this

Need Support for image load error

need onError prop or something, when some image give error like 404. I need to revert to some other image or some other action according to need

Can render more eagerly in certain situations than does at the moment.

Before you submit:

Is your feature request related to a problem? Please describe.
At the moment, if the component is used in any of the following ways:

  • width and height set
  • fluid={false}

the component still takes two render passes to fully render, when it can be completed in one.

Describe the solution you'd like
Check whether either of the following are true and eagerly render if true:

  • width != null && height != null
  • fluid === false

Background URLs containing parenthesis do not display

I ran into an edge case where certain URLs in our buckets have a left parenthesis ( as part of the URL string. This breaks the background-image: style resulting in a blank image.

I did a little testing locally and found line 150 to be the culprit:

backgroundImage: isStringNotEmpty(_src) ? `url(${_src})` : null,

A quick test adding single quotes around the url seems to solve this problem for me:
url('${_src}')

Pull Requests fail for non-contributor PRs due to Travis not setting environment variables.

Currently, Pull Requests submitted by non-contributors fail on CI because the integration tests fail. This is because Travis does not provide environment variable to outsiders' Pull Requests for safety reasons, and so the tests cannot log in to BrowserStack.

The testing logic can be updated to run integration tests for contributors, and just headless tests on chrome for others.

See here for an example of this.

Support for sizes, and width descriptors

Hey @frederickfogerty, thanks for putting out this library. Somewhat connected to #71, but while trying to use to do responsive images, I noticed that the library doesn't currently support sizes prop for <img>, or width descriptors (density descriptors seem to be supported via dpr) within srcSet.

Not sure if I missed something, or if there was a reason for that? If not, would this be something on the radar to add?

Thanks!

any plans to support the <picture> element?

is supporting <picture> in the roadmap at all?

i've hacked this together locally using processImage but i'm guessing that's not meant for public consumption. i could try to put a pr together but i'm still sorting through what the api would look like..

Unknown Prop Warning in React 15.2.1

I get this react warning when updating to the latest react version 15.2.1. As far as I can tell being more explicit about what props are passed to the img tag fixes the warning for me. You can see the approach I took on my fork. Happy to submit a PR but wanted to know if this is the best approach?.

With aggressiveLoad true, on Safari, it's loading full size images

We've been seeing an issue on Safari, where if we turn on aggressiveLoad={true}, every image gets loaded on Safari (mobile and desktop 9.x) with w=1&h=1 and this fetches the original images sizes. This is bloating the payload and on some phones crashing Safari.

If I inspect source in the Safari inspector, I don't see w=1&h=1, I see the correct width w=400&h=1. This is made worse if you leave generateSrcSet on since it'll fetch all srcs at the original size for some reason.

We've only seen this on Safari, it works fine everywhere else.

Picture tag with generateSrcSet with an undefined src generates links to 2x, 3x urls

If you use type=picture and then use generateSrcSet, but the src is falsey or undefined, then the output will still render a srcset that looks like (unknown), 2x, 3x. Why is this a problem? The browser will treat the 2x and 3x as images and try to prefetch one of the source tag urls and it'll 404.

The expected behavior I'm not sure about. It could generate no source tags if the src is falsey. It could just omit the 2x, 3x from the srcset so that the image is still broken, but wont generate a 404.

Here's an image of the output:

image

Example code:

<Imgix
  src={ someUrl }
  type="picture"
>
  <Imgix
    generateSrcSet
    height={ 525 }
    src={ portraitSrc }
    type="source"
  />
</Imgix>

Picture Support for Responsive images not working

type: question

react-imgix version: 7.1.1

Code

<div className={classes.image}>
  <Imgix
    src={src}
    onMounted={ar => {
      console.log(ar)
    }}
    width={1400}
    fit={'clip'}
    auto={['format', 'compress']}
    type="picture"
  >
    <Imgix
      src={src}
      width={400}
      type="source"
      imgProps={{media: '(min-width: 768px)'}}
    />
    <Imgix
      src={src}
      width={200}
      type="source"
      imgProps={{media: '(min-width: 320px)'}}
    />
  </Imgix>
</div>

Actual behavior:
For some reason it resizes it to really finny size.

Screen_Shot_2018-06-08_at_15.25.22.png

React Version: 16.3.2

Thoughts on option to strip protocol from urls.

Many services return image urls with http:// as the protocol. If requested over https:// they will result in errors.

A boolean prop that would strip the protocol from the src attribute would be useful for many developers.

<Imgix
  src={imageUrl}
  stripProtocol
/>

Would you be interested in a PR implementing this?

Expose url generation function from react-imgix to support custom url generation

type: feature request

react-imgix version: v1.0

Code

import {toURL} from 'react-imgix';

<video poster={toURL(...)}>...</video>

Expected behavior:

react-imgix exports a function that returns a Imgix URL with as many of the react-imgix options and defaults as make sense. (no auto-sizing)

Actual behavior:

react-imgix only exports a component

Workaround:

Do not use <video poster />. Instead render an image with a click handler that swaps out for the video and begins playback.

Remove "fallback src" in srcset generation

Describe the bug
We're currently adding a "sizeless" source URL to the end of our srcset attributes as a "fallback source", which is incorrect. The "fallback source" for an image element using the srcset attribute should be provided in the src attribute, not at the end of the srcset list.

See the lines in question here: https://github.com/imgix/react-imgix/blob/master/src/react-imgix.js#L124-L125

To Reproduce
N/A

Expected behaviour
Every item in the srcset list should include a size descriptor, which in our case is always a width value or a resolution multiplier.

Information:

  • react-imgix version: >= 8.0.0

Additional context
This issue is also present in imgix-rails, and is being fixed here: imgix/imgix-rails#69

Add background mode back

Before you submit:

Is your feature request related to a problem? Please describe.
I would like to set images as the background image of components such as div so I can place other items within this element.

Describe the solution you'd like

<Imgix type="bg" src="..."><Heading>Blog Header</Heading></Imgix>

We could make this work by requiring width and height to be specified, as determining this ourselves is too error prone.

SSR markup does not contain image src attribute

type: bug

react-imgix version: v7.1.1

Code

<img src={getImgixUserPicture(this.props.auth.user.picture)} />
<Imgix
      alt="user"
      auto={['compress']}
      src={getImgixUserPicture(this.props.auth.user.picture)}
      type="img"
      width={40}
      height={40}
/>

Expected behavior:
I am server-side rendering my whole application, when my HTML markup is generated the image src tag does not exist. In the example code above I have provided a normal image tag as well as one with Imgix, and the rendered markup is different between the two. For example my code above generates the following markup (please note the second image has no src tag):

<img src="https://mysite-dev.imgix.net/avatars/2018/6/f5946b91-7579-4b1d-852b-91fbdb99bab4.jpeg"/><img width="40" height="40"/>

Actual behavior:
I would expect that react-imgix would generate the same markup that a normal image tag would regardless of being rendered on the server.

React Version: 16.4

Whole HTML page can be unexpectedly requested multiple times

There is a pretty epic and hard to spot bug in ReactImgix. It took me several hours to track this down as it's very subtle.

We were observing multiple requests to our backend servers for each pageview that included ReactImgix on it. It turns out that there is a subtle browser behaviour where a blank URL is interpreted as 'the current page' this means setting backgroundImage = url() will actually attempt to request the entire html page as an image. I believe this is also true of <img src="" /> nodes too.

The two specific bugs in ReactImgix are...

  • setting bg=true causes the initial render pass to generate styles such as backgroundImage = url()
  • without aggressiveLoad set the initial render pass generates an img tag like <img src="" srcset="" />

It's particularly noticeable when using server side rendering as this first render pass is what gets returned to the client because there is no DOM to mount.

For the bg=true case I think this can be easily fixed by simply not setting the backgroundImage style attr until the src attr is computed and present. E.g. we have patched this locally using...

if (_src && _src.length > 0) childProps.style.backgroundImage = `url(${_src})`

Some possible, but as yet totally untested solutions for the src attr might be to...

  • leave the src attribute off entirely (this would be best if it works but I've not tested it)
  • set src="about:blank" (smallest change, not sure if it would work)
  • render a <span> tag instead of the actual image. (probably a breaking change and not really desirable but would work)

Add mention-bot

You know, for that sweet PR workflow. Since I don't have ownership anymore ( 😭 ) I can't do this.

How To Use?

  • Go to
    • your project on GitHub > Settings > Webhooks & services > Add Webhook or
    • your organization on GitHub > Settings > Webhooks > Add Webhook
  • Payload URL: https://mention-bot.herokuapp.com/
  • Let me select individual events > Check Pull Request
  • Add Webhook

And you are done. Next time a pull request is opened, you should see the bot add a comment ;)

https://github.com/facebook/mention-bot

Incorrect warning about a missing fallback image

Before you submit:

Describe the bug
The library warns about a missing fallback <img /> or <Imgix /> tag when those components not immediate descendants.

We have wrapped <Image />, <Source /> and <Picture /> with our own small wrapper components to set defaults and tweak the behavior slightly. The library iterates through this.props.children and explicitly looks for the ReactImgix constructors or a ReactDOM "img" component. react-imgix should provide an escape hatch to prevent this warning (some kind of static decoration on the wrapper component, maybe), or should recursively iterate through the children to find the fallback component.

To Reproduce

import Imgix, {
  Source as ImgixSource,
  Picture as ImgixPicture
} from 'react-imgix'

// Set some default URL params
function addDefaultImgixParams(params: ImgixProps['imgixParams']) {
  return Object.assign(
    {
      auto: ['compress', 'format'], // Default to compressing and reformatting (https://docs.imgix.com/apis/url/auto)
      ch: ['Width', 'DPR', 'Save-Data'] // Default to setting all client-hints (https://docs.imgix.com/apis/url/format/ch)
    },
    params
  )
}

// Wrap <Image />
export interface ImageProps extends ImgixProps {}
const Image: React.SFC<ImageProps> = ({ imgixParams, ...props }) => {
  imgixParams = addDefaultImgixParams(imgixParams)

  return <Imgix imgixParams={imgixParams} {...props} />
}

// Wrap <Source />
export interface SourceProps extends ImgixSourceProps {}
const Source: React.SFC<SourceProps> = ({ imgixParams, ...props }) => {
  imgixParams = addDefaultImgixParams(imgixParams)

  return <ImgixSource imgixParams={imgixParams} {...props} />
}

// Wrap <Picture />
export interface PictureProps extends ImgixPictureProps {}
const Picture: React.SFC<PictureProps> = props => <ImgixPicture {...props} />

// Attempt to render a responsive image:
<Picture>
  <Source ... />
  <Image ... />
</Picture>

// ^^ This results in a warning.

Expected behaviour
The library should not log a warning to the console if the resulting markup includes a valid fallback image.

Information:

  • react-imgix version: v8.0.0

Additional context:

This is a useful warning, but unfortunately is implemented in such a way that isn't flexible enough.

Setting width (height) props, sets the width (height) on the <img> tag

This:

<Imgix 
  src="images/example.png"
  width={87}
  height={87}
  fit="fill"
/>

outputs an img with width and height props:

<img 
  width="87" 
  height="87" 
  srcset="..." 
  src="https://example.imgix.net/images/example.png?auto=format&amp;dpr=1&amp;crop=faces&amp;fit=fill&amp;w=87&amp;h=87"
/>

Which renders this:

image

instead of this:

image

Background doesn't support changing fit

Describe the bug
Setting a imgixParams fit to anything but crop has no effect. It still is set to crop as the fit is hardcoded. It should be able to be override by passing a imgixParams fit value.

To Reproduce
https://codesandbox.io/s/540nzkv4qn

Steps to reproduce the behaviour:

  1. Create a new Background element
  2. Set imgixParams.fit to anything but crop
  3. See URL has fit=crop

Expected behaviour
Fit should change depending what is set in imgixParams

Information:

  • react-imgix version: latest

Ability to set aspectRatio

Before you submit:

Is your feature request related to a problem? Please describe.
It's currently impossible to maintain the aspect ratio correctly when using srcSet and sizes.
A lot of the other Imgix libraries support the ability to set the aspectRatio or handle aspectRatio in their calculations.

Describe the solution you'd like
An aspectRatio prop and for srcSets to respect the supplied aspect ratio.

Intro + React Questions

Hey @frederickfogerty, I'm Paul Straw. I'm handling Developer Relations at imgix now, so I'll be working with you a bit to help continue improving react-imgix.

We recently had a customer raise a couple questions about react-imgix, and I wanted to run them by you and hopefully get your thoughts:

  • React 0.14 requirement: Do you have any sense of what React 0.13 vs 0.14 usage looks like? I dug on this for a bit, but it doesn't seem to be well-documented, unfortunately. Personally, I think keeping the react-imgix 1.0.4 version around is probably fine, just wanted to see if you have any idea whether this could be a common issue.
  • Babel requirement: How would you feel about including a pre-built version of the library to support people who either aren't using Babel, or are using a more limited subset of its features?

I'm happy to implement either of these myself, but at least wanted to get your thoughts before jumping in.

Thanks!
-paul

width and height don't do the right thing when they differ from width and height of sources

moved from here

Edit: issue seems to be coming from the generated fallback element with the Picture Support. You need to define the width/height of the image on the parent element otherwise it will load the 1x1 version by default on the fallback ! (crashing Safari/mobiles if you have big images by default).

something else i noticed yesterday in my work's codebase - you not only have to have a width/height on the parent element but it also needs to be the maximum width/height of any of the <source> elements that may be inside of the generated <picture>. so this:

<Imgix type="picture" src={src} width={100} height={100}>
  <Imgix type="source" src={src} width={400} height={100} imgProps={{ media: '(min-width: 768px)' }} />
</Imgix>

will load the 400x100 image on a large screen but will only display it as 100x100 (at least in chrome and safari)

i think this is a bug - in my local testing setting the provided height/width on the fallback image but changing the same attributes on the parent container to the maximum values did the right thing everywhere. working around it doesn't seem hard but it's unclear if that's the expected behavior though. should i just open a new bug to discuss this?

Cannot specify min or max width/height

The width and height params have default values specified by the Imgix component, and appear to take precedence over the min-h, min-w, max-h, max-w params when processed on Imgix.

The end result is, you may be able to specify the min-w, etc. And it will show up in the URL. But because the w and h params are also specified, the min/max params get ignored.

Support Variable Qualities for SrcSet

type: feature request

When working with SrcSets I find it's pretty important to specify lower encoding qualities for the high-dpi images, otherwise you end up with your largest file sizes being served to mobile devices (which are most sensitive to file size). This is because phones/tablets tend to both display images full width instead of in columns, and are more likely to have high DPI screens. High resolutions with high compression ratios still look significantly better at similar file sizes to lower resolution uncompressed images on these displays, so it's still worth using srcsets rather than just leaving them off.

In fact, this mirrors the Imgix's own recommendation: https://docs.imgix.com/tutorials/responsive-images-srcset-imgix (See "Use Variable Quality")

The trick is, I can't find a way to specify parameters per-dpi with this library. My first thought about what the API would look like would be something like this:

<Imgix src={url} faces={false} fit="max" generateSrcSet={[{q: 95}, {q: 75}, {q: 50}]} /> 

where each element in the array is basically a customParams object, but specifically targeted at that srcset entry (so the first one is 1x, the second one is 2x, the third is 3x). This is super flexible (supports more than just changing the quality), and would potentially even unlock custom dprs like this:

<Imgix src={url} generateSrcSet={[{q: 95, dpr: 1}, {q: 75, dpr: 1.5}, {q: 50, dpr: 2}]} /> 

Thoughts? Am I missing something?

Thanks!

  • Adam

Increase usefulness of test suite

To increase the usefulness of the test suite in covering real usage of this library, the following test cases should be covered. This is a living issue, so this list will increase as the issues are worked through.

  • When using a custom component > when in image mode

LQIP Images

type: feature request

react-imgix version: v1.0

It would be nice to have medium.com style progressive loading, like this and have a component to load imgix images. The need for the former made me not want to use this component, both would be great.

I would imagine a prop to enable it, and then by providing an imgix url it would do what graphcms-image can do with some sensible defaults.

v8 Breaking Changes Discussion

There are some things that may be good ideas to change in the next release as a breaking change. I've created this issue to track these discussions.

Ideas

Reducing the "magic" ✅

This library does some things by default which may not make sense for the average Joe who stumbles across this component. To reduce the number of surprises for new users, these changes could be made:

  • change faces default to false - ✅ #162
  • remove precision default (or make logic smarter, as below) Removed in #159

Changing the <picture> API to remove automatic fallback creation ✅

See more here

Also, it seems to make sense to expose the media prop for <source> elements as a top-level prop.

Different components for different modes (picture, bg, img) ✅ - #163

Currently, there are some props which only make sense for a specific mode (e.g. generateSrcSet only makes sense for <img> mode, or component for bg mode). Having all props accessible for all modes is confusing and error-prone. An option here is to expose different components for different modes, such as Img, Picture, and Source.

Reduce/consolidate props - ✅ #162

A lot of imgix "image transform" parameters, such as fit and crop, which are exposed at the top level, could be rolled into one imgixOptions param. This would reduce the top-level surface area, and would make the props more understandable as these options logically fit together.

Use srcsets and sizes instead of calculating image dimensions directly - #159

Browser support for srcSets and sizes has come a long way, which makes this technique now viable for responsive images. As this offloads of the responsiveness onto the browser, it allows responsiveness to be more stable and performant and reduces the responsibilities of this library.

Comments

I welcome all contributors to comment on this issue and discuss the options presented. Everyone is welcome, but I'll call out some large contributors and recent users here: @modosc @Krucial92 @woss @harrisrobin

Include the Imgix.js generated srcset within react-imgix library

Imgix.js is great at what it does, unfortunately due to the nature of the html being generated after the DOM is loaded, there is always a risk of a flicker for the user.

I was looking into using this library instead to create responsive images, but noticed that the fancy srcset generation that Imgix.js does isn't part of this library.

It'd be great if we can have it generate that srcset list here as well :)

Manage component mounted state better

If the component is unmounted any time forceLayout happens, or any other render, it will cause this to throw an error which might make React bail out and crash.

Fluid on one dimension

I'm trying to make the image fluid on only one dimension, but this library seems to not allow me to do it.

One way to resolve it I think is to support float height/width (https://docs.imgix.com/apis/url/size/h). Right now if I pass the props of height = 1.0 to the component, it outputs an image literally with height of 1px, which is behaving differently from the imgix documentation.

Use sizes on <Source> to generate srcSet

Before you submit:

Describe the bug

It looks like the <Source> component ignores the sizes= attribute and just generates a srcSet with different resolutions. I think it's this line:

if (fixedSize || type === "source") {

But I think <source> should be able to support fluid width images the same as <img>? Is there a reason that <Source> components are grouped in with fixed size images?

To Reproduce

<Picture>
  <Source
    src={desktopSrc}
    sizes="100vw"
    htmlAttributes={{ media: "(min-width: 768px)" }}
  />
  <Source
    src={mobileSrc}
    sizes="100vw"
    htmlAttributes={{ media: "(min-width: 320px)" }}
  />
  <Imgix src={mobileSrc} sizes="100vw" />
</Picture>

Expected behaviour

I'd expect a <Source> to generate its srcSet based on sizes= similar to the <Imgix> component - otherwise art-directed images end up much larger than they need to be.

ssr broken when using bg

when we use server-side rendering and disable client-side js we get an empty background-image tag. this is fixed by enabling aggressiveLoad.

we don't see the same issue without bg, those images load fine.

i think either the docs should be updated to explain this or aggressiveLoad should be implicitly enabled when using bg, not sure which?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.