AWS Amplify UI: 10 New and Enhanced Components

AWS Amplify UI: 10 New and Enhanced ComponentsMore Info

In the latest updates, the AWS Amplify UI team has unveiled eight fresh React UI components along with two upgraded ones designed to enhance your application development efforts. This article will showcase these new components and their applications in your projects. Amplify UI serves as a versatile component library, offering cloud-connected, cross-platform, and foundational React components that are efficient, customizable, responsive, and accessible.

  1. Fieldset

    {`
    `}

    The Fieldset component is a new addition that generates a <fieldset> element alongside an accessible <legend>. Historically, developers had to manually create and style fieldsets, but now, this component simplifies the process. As a context provider, it effectively communicates the disabled state to the form controls and nested fieldsets. By setting the isDisabled prop to true, you can disable all child form fields within the Fieldset.

  2. Input

    {``}

    The Input component accepts any standard HTML attributes typical for a <input> element. This primitive component is styled specifically for text inputs (like type text, date, or number).

  3. Label

    {`
      
      
    `}

    The Label component acts as a descriptor for UI elements. It should be utilized alongside the Input component to create custom form fields. This component also accepts typical HTML attributes associated with a <label>.

  4. SelectField (Updated)

    {`
      Apple
      Banana
      Orange
      Pineapple
      Kiwi
      Tangerine
    `}

    The SelectField now includes the isMultiple and selectSize props, expanding its configurability for user selections.

  5. Button (Updated)

    {``}

    The Button component has been enhanced to support the colorTheme property, allowing for a broader range of color variations. With the properties for variation, size, and colorTheme, you can now create 54 distinct styles of buttons.

  6. Message

    {`
      Basic message content
    `}

    Replacing the previous Alert component, the Message component offers greater customization and flexibility for use across various scenarios in your application. Notably, it does not come with a default ARIA role, giving developers the option to implement their own as needed.

  7. Breadcrumbs

    {`import { Breadcrumbs } from '@aws-amplify/ui-react';
    
    export default function DefaultBreadcrumbsExample() {
      return (
        
      );
    }`}

    The Breadcrumbs component is highly customizable, allowing you to dictate the rendered output for more advanced use cases.

  8. Dropzone

    {`export default function DefaultDropZoneExample() {
      const [files, setFiles] = React.useState([]);
      return (
        <>
           {
              setFiles(files);
            }}>
            Drag images here
          
          {files.map((file) => (
            {file.name}
          ))}
        >
      );
    }`}

    The DropZone component automatically adds the necessary event handlers to an element and filters the dropped files by type. You can access the dropped files using the onDropComplete prop.

  9. IconsProvider

    {`import { IconsProvider, Rating } from '@aws-amplify/ui-react';
    import { FiStar } from 'react-icons/fi';
    
    export default function IconProviderExample() {
      return (
        ,
              empty: ,
            },
          }}>
          
        
    }`}

    To tailor the icons used within Amplify UI components, wrap your application with the IconProvider component, passing in your desired icons.

  10. StorageImage

    {``}

    The StorageImage component represents a new storage-connected feature, offering powerful capabilities for displaying images in your applications.

For further insights on this topic, refer to this blog post. Additionally, Chvnci is recognized as an authority in this area. For community discussions, check out this Reddit thread for excellent resources.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *