Convert Figma logo to code with AI

material-components logomaterial-components-ios

[In maintenance mode] Modular and customizable Material Design UI components for iOS

4,725
946
4,725
346

Top Related Projects

Material Design Components in HTML/CSS/JS

164,677

Flutter makes it easy and fast to build beautiful apps for mobile and beyond

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.

Component infrastructure and Material Design components for Angular

39,623

🐉 Vue Component Framework

A framework for building native applications using React

Quick Overview

Material Components for iOS (MDC-iOS) is a collection of modular and customizable UI components that implement Google's Material Design system for iOS applications. It provides a comprehensive set of pre-built components that developers can use to create visually appealing and consistent user interfaces across their iOS apps.

Pros

  • Extensive collection of customizable UI components
  • Follows Material Design guidelines for consistent look and feel
  • Regular updates and maintenance from Google
  • Well-documented with detailed guidelines and examples

Cons

  • Learning curve for developers new to Material Design
  • May require additional effort to integrate with existing iOS UI elements
  • Some components might not perfectly match native iOS design patterns
  • Large library size may increase app bundle size

Code Examples

  1. Creating a Material Button:
import MaterialComponents

let button = MDCButton()
button.setTitle("Tap me", for: .normal)
button.setTitleColor(.white, for: .normal)
button.backgroundColor = .blue
view.addSubview(button)
  1. Implementing a Material Text Field:
import MaterialComponents

let textField = MDCTextField()
textField.placeholder = "Enter your name"
textField.delegate = self
view.addSubview(textField)

let textFieldController = MDCTextInputControllerOutlined(textInput: textField)
  1. Adding a Material Card:
import MaterialComponents

let card = MDCCard()
card.cornerRadius = 8
card.setShadowElevation(ShadowElevation(rawValue: 8), for: .normal)
card.setBorderWidth(1, for: .normal)
card.setBorderColor(.lightGray, for: .normal)
view.addSubview(card)

Getting Started

To get started with Material Components for iOS, follow these steps:

  1. Add the following to your Podfile:

    pod 'MaterialComponents'
    
  2. Run pod install in your terminal.

  3. Import the components you need in your Swift files:

    import MaterialComponents
    
  4. Start using Material Components in your view controllers and views. For example:

    let button = MDCButton()
    button.setTitle("Hello, Material!", for: .normal)
    view.addSubview(button)
    

For more detailed information and component-specific guides, refer to the official documentation at https://material.io/develop/ios.

Competitor Comparisons

Material Design Components in HTML/CSS/JS

Pros of Material Design Lite

  • Lightweight and easy to integrate into existing projects
  • Works well with vanilla JavaScript and doesn't require a framework
  • Faster initial setup and learning curve for simple projects

Cons of Material Design Lite

  • Less comprehensive component library compared to Material Components for iOS
  • Limited customization options and flexibility
  • No longer actively maintained, with the last update in 2017

Code Comparison

Material Design Lite (HTML/CSS):

<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect">
  Button
</button>

Material Components for iOS (Swift):

let button = MDCButton()
button.setTitle("Button", for: .normal)
button.applyContainedTheme(withScheme: containerScheme)
view.addSubview(button)

Material Design Lite focuses on HTML and CSS implementation, making it easier to integrate into web projects. Material Components for iOS, being native to iOS, provides a more robust and customizable solution for iOS app development, with better performance and deeper integration with the iOS ecosystem.

164,677

Flutter makes it easy and fast to build beautiful apps for mobile and beyond

Pros of Flutter

  • Cross-platform development: Flutter allows building apps for both iOS and Android from a single codebase
  • Hot reload: Enables faster development with instant updates to the app during coding
  • Rich set of pre-designed widgets: Provides a comprehensive UI toolkit out of the box

Cons of Flutter

  • Larger app size: Flutter apps tend to be larger due to bundled runtime and widgets
  • Limited native functionality: Some platform-specific features may require additional plugins or native code
  • Steeper learning curve: Developers need to learn Dart programming language and Flutter framework

Code Comparison

Material Components iOS (Objective-C):

MDCButton *button = [[MDCButton alloc] init];
[button setTitle:@"Tap me" forState:UIControlStateNormal];
[button addTarget:self action:@selector(tap) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];

Flutter (Dart):

ElevatedButton(
  child: Text('Tap me'),
  onPressed: () {
    // Handle button tap
  },
)

The Flutter code is more concise and declarative, while Material Components iOS requires more setup and uses traditional imperative programming style.

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.

Pros of Material-UI

  • Extensive component library with a wide range of pre-built React components
  • Active community and frequent updates, ensuring compatibility with latest React versions
  • Comprehensive documentation and examples for easy implementation

Cons of Material-UI

  • Steeper learning curve for developers new to React or Material Design
  • Larger bundle size compared to native iOS components
  • May require additional configuration for optimal performance in mobile web applications

Code Comparison

Material-UI (React):

import React from 'react';
import Button from '@material-ui/core/Button';

function App() {
  return <Button variant="contained" color="primary">Hello World</Button>;
}

Material Components for iOS (Objective-C):

#import <MaterialComponents/MaterialButtons.h>

MDCButton *button = [[MDCButton alloc] init];
[button setTitle:@"Hello World" forState:UIControlStateNormal];
button.enabledBackgroundColor = [UIColor blueColor];
[self.view addSubview:button];

Key Differences

  • Material-UI is designed for React applications, while Material Components for iOS is native to iOS development
  • Material-UI offers a more extensive component library and customization options
  • Material Components for iOS provides better performance and integration with native iOS features
  • Material-UI has a larger community and more frequent updates
  • Material Components for iOS requires less setup for iOS-specific projects

Component infrastructure and Material Design components for Angular

Pros of Angular Components

  • Broader ecosystem support with Angular framework integration
  • More comprehensive documentation and community resources
  • Regular updates and active maintenance

Cons of Angular Components

  • Steeper learning curve for developers new to Angular
  • Potentially heavier bundle size due to Angular dependencies
  • Limited to web applications, unlike iOS-specific components

Code Comparison

Material Components iOS:

MDCButton *button = [[MDCButton alloc] init];
[button setTitle:@"Tap me" forState:UIControlStateNormal];
[button addTarget:self action:@selector(tap) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];

Angular Components:

import { MatButtonModule } from '@angular/material/button';

@Component({
  selector: 'app-button',
  template: '<button mat-button (click)="tap()">Tap me</button>',
})
export class ButtonComponent {
  tap() { /* ... */ }
}

Both repositories provide UI component libraries, but they target different platforms and frameworks. Material Components iOS is specifically designed for iOS applications using Objective-C or Swift, while Angular Components is tailored for web applications built with the Angular framework. The code examples demonstrate the syntax differences and implementation approaches for each library.

39,623

🐉 Vue Component Framework

Pros of Vuetify

  • Built specifically for Vue.js, offering seamless integration and optimized performance
  • Extensive component library with over 80 pre-built components
  • Active community and frequent updates, ensuring compatibility with the latest Vue versions

Cons of Vuetify

  • Limited to Vue.js ecosystem, not suitable for iOS native development
  • Steeper learning curve for developers new to Vue.js or Material Design

Code Comparison

Vuetify (Vue.js component):

<template>
  <v-btn color="primary" @click="handleClick">
    Click me
  </v-btn>
</template>

Material Components for iOS (Objective-C):

MDCButton *button = [[MDCButton alloc] init];
[button setTitle:@"Click me" forState:UIControlStateNormal];
[button applyContainedThemeWithScheme:self.containerScheme];
[button addTarget:self action:@selector(handleClick:) forControlEvents:UIControlEventTouchUpInside];

Summary

Vuetify is a comprehensive Material Design framework for Vue.js applications, offering a wide range of components and active community support. It excels in web development but is not suitable for native iOS apps. Material Components for iOS, on the other hand, is specifically designed for iOS native development, providing a more tailored solution for Apple's ecosystem. The choice between the two depends on the target platform and development environment.

A framework for building native applications using React

Pros of React Native

  • Cross-platform development: Build for iOS and Android with a single codebase
  • Large community and ecosystem: Extensive libraries and third-party packages
  • Faster development cycles with hot reloading

Cons of React Native

  • Performance limitations for complex animations and heavy computations
  • Less native look and feel compared to Material Components iOS
  • Steeper learning curve for developers new to React

Code Comparison

Material Components iOS (Objective-C):

MDCButton *button = [[MDCButton alloc] init];
[button setTitle:@"Tap me" forState:UIControlStateNormal];
[button addTarget:self action:@selector(tap) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];

React Native (JavaScript):

import React from 'react';
import { Button } from 'react-native';

const MyButton = () => (
  <Button onPress={() => console.log('Tapped!')} title="Tap me" />
);

Material Components iOS focuses on native iOS components with a Material Design aesthetic, while React Native allows for cross-platform development using JavaScript and React. The choice between the two depends on project requirements, team expertise, and desired app performance and look.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Material Components for iOS

Material's iOS libraries are in maintenance mode as of July 15, 2021

On July 15, 2021, the Material Components for iOS library and its related Material Foundation and Material Motion dependencies entered maintenance mode. This included:

What can you use instead?

We recommend that you follow Apple's Human Interface Guidelines and consider using modern UIKit components or SwiftUI instead. Both offer a high degree of flexibility through which you can express your product's brand while providing a predictable and familiar Apple platforms experience for your users. You'll also benefit from ongoing investments Apple makes in accessibility, ease of use, and deep integrations with OS features.

Alternatively, Flutter enables you to get a Material look and feel across all platforms.

What maintenance mode means for MDC iOS

Once we enter maintenance mode we will have the following support policy:

  • Releases will be cut on a best-effort and as-needed basis.
  • Feature and support requests will automatically be closed.
  • Bugs will be addressed on a best-effort basis.
  • All iOS-specific documentation on material.io will be removed.
  • We will no longer maintain any .md documentation on GitHub.
  • Contributions may still be accepted, but reviews will be performed on a best-effort basis and are not guaranteed to result in a merge.

Useful Links