# syncfusion/maui-toolkit architecture

> Architecture diagram of the GitHub repository syncfusion/maui-toolkit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/syncfusion/maui-toolkit
- Repository: https://github.com/syncfusion/maui-toolkit

## Overview

##### Project’s Main Components
- Core Library – The “maui/src” folder contains the majority of the shared code (controls, core classes, base views, helpers, extensions, themes, and platform-agnostic functionalities). This is the heart of the toolkit.
- Platform-Specific Implementations – Many controls are implemented using partial classes or platform-specific files (e.g., “SfBottomSheet.Windows.cs”, “CarouselHandler.Android.cs”, and similar files under “maui/src”). These illustrate the cross-platform abstraction – a single UI control with different underlying implementations for Android, iOS, Windows, etc.
- Samples – The “maui/samples” folder shows practical usage coupled with MVVM-based sample applications. It’s beneficial to represent the sample gallery as a demonstration layer that consumes the toolkit.
- Supporting Files – Additional configuration files (e.g., Directory.Build, .editorconfig, .github documents) show how the project is managed, contributed to, and built. Although less central, you may note them as part of the development and build lifecycle.

##### Relationships and Interactions
- That the Core Library (shared code in “maui/src”) is the central module from which all controls derive functionality.
- That each UI control (like Accordion, Carousel, Chart, etc.) builds upon the “Core” and then branches off into two implementation paths: a shared abstraction and platform-specific adapters/rendering handlers.
- Samples layer to the controls to show how sample applications in “maui/samples” demonstrate configuration (see MauiProgram.cs usage) and integration of the toolkit controls.
- A component for Unit Tests that validate individual controls and core functionality.
- Optionally, indicate how build pipelines (under “pipelines” and “targets”) tie into the overall architecture as tools for ensuring consistency and deployment readiness.

##### Architectural Patterns and Design Principles
- MVVM Pattern in Samples: Although the toolkit is primarily a UI library, the samples follow MVVM (as seen in “ViewModel” subfolders), so you may note that sample apps demonstrate the recommended application architecture.
- Cross-Platform Abstraction: Emphasize that the toolkit uses a common API while providing specialized implementations for different platforms.

##### Relevant Technologies and Frameworks
- .NET MAUI – as the cross-platform UI framework.
- C# and .NET 9 (as seen in the README badges) – for language and runtime.
- Dependency Injection techniques used in MauiProgram.cs to register and initialize the toolkit extension.
- Unit testing frameworks (likely MSTest, xUnit, or NUnit) integrated into “maui/tests.”

## Diagram (Mermaid)

```mermaid
graph TD
    %% Toolkit Core
    subgraph "Toolkit Core"
        CoreLibrary["Core Library"]:::core
        subgraph "UI Controls"
            Accordion["Accordion"]:::control
            Button["Button"]:::control
            Calendar["Calendar"]:::control
            Cards["Cards"]:::control
            Carousel["Carousel"]:::control
            Charts["Charts"]:::control
            Chip["Chip"]:::control
            EffectsView["EffectsView"]:::control
            Expander["Expander"]:::control
            NavigationDrawer["Navigation Drawer"]:::control
            NumericEntry["Numeric Entry"]:::control
            OtpInput["Otp Input"]:::control
            Popup["Popup"]:::control
            PullToRefresh["Pull-To-Refresh"]:::control
            SegmentedControl["Segmented Control"]:::control
            Shimmer["Shimmer"]:::control
            TabView["TabView"]:::control
            TextInputLayout["TextInputLayout"]:::control
            BottomSheet["BottomSheet"]:::control
        end
    end

    %% Platform-Specific Implementations
    subgraph "Platform-Specific Implementations"
        SfBottomSheet_Win["SfBottomSheet (Windows)"]:::platform
        SfBottomSheet_iOS["SfBottomSheet (iOS)"]:::platform
        CarouselHandler_Android["CarouselHandler (Android)"]:::platform
        CarouselHandler_iOS["CarouselHandler (iOS)"]:::platform
        CarouselHandler_Win["CarouselHandler (Windows)"]:::platform
    end

    %% Usage and Testing
    subgraph "Usage and Testing"
        Samples["Sample Applications"]:::sample
        Tests["Unit Tests"]:::test
        BuildCI["Build/CI Pipelines"]:::build
    end

    %% Supporting Files & Config
    subgraph "Supporting Files & Config"
        Config["Project Configuration & Supporting Files"]:::config
    end

    %% Connections from Core Library to UI Controls (illustrating shared base functionality)
    CoreLibrary -->|"base"| Accordion
    CoreLibrary -->|"base"| Button
    CoreLibrary -->|"base"| Carousel
    CoreLibrary -->|"base"| BottomSheet

    %% Connections from UI Controls to Platform-Specific Implementations (platform adapters)
    Carousel -->|"platformAdapter"| CarouselHandler_Android
    Carousel -->|"platformAdapter"| CarouselHandler_iOS
    Carousel -->|"platformAdapter"| CarouselHandler_Win
    BottomSheet -->|"platformAdapter"| SfBottomSheet_Win
    BottomSheet -->|"platformAdapter"| SfBottomSheet_iOS

    %% Sample Applications consuming UI Controls
    Samples -->|"demonstratesUsage"| Accordion
    Samples -->|"demonstratesUsage"| Button
    Samples -->|"demonstratesUsage"| Carousel

    %% Testing and Build Pipelines interactions with Core Library
    Tests -->|"validates"| CoreLibrary
    BuildCI -->|"builds"| CoreLibrary
    Config -->|"manages"| CoreLibrary

    %% Click Events
    click CoreLibrary "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src"
    click Accordion "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/Accordion"
    click Button "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/Button"
    click Calendar "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/Calendar"
    click Cards "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/Cards"
    click Carousel "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/Carousel"
    click Charts "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/Charts"
    click Chip "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/Chip"
    click EffectsView "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/EffectsView"
    click Expander "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/Expander"
    click NavigationDrawer "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/NavigationDrawer"
    click NumericEntry "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/NumericEntry"
    click OtpInput "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/OtpInput"
    click Popup "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/Popup"
    click PullToRefresh "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/PullToRefresh"
    click SegmentedControl "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/SegmentedControl"
    click Shimmer "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/Shimmer"
    click TabView "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/TabView"
    click TextInputLayout "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/TextInputLayout"
    click BottomSheet "https://github.com/syncfusion/maui-toolkit/tree/main/maui/src/BottomSheet"
    click SfBottomSheet_Win "https://github.com/syncfusion/maui-toolkit/blob/main/maui/src/BottomSheet/SfBottomSheet.Windows.cs"
    click SfBottomSheet_iOS "https://github.com/syncfusion/maui-toolkit/blob/main/maui/src/BottomSheet/SfBottomSheet.iOS.cs"
    click CarouselHandler_Android "https://github.com/syncfusion/maui-toolkit/blob/main/maui/src/Carousel/Handlers/CarouselHandler.Android.cs"
    click CarouselHandler_iOS "https://github.com/syncfusion/maui-toolkit/blob/main/maui/src/Carousel/Handlers/CarouselHandler.iOS.cs"
    click CarouselHandler_Win "https://github.com/syncfusion/maui-toolkit/blob/main/maui/src/Carousel/Handlers/CarouselHandler.Windows.cs"
    click Samples "https://github.com/syncfusion/maui-toolkit/tree/main/maui/samples"
    click Tests "https://github.com/syncfusion/maui-toolkit/blob/main/maui/tests/Syncfusion.Maui.Toolkit.UnitTest"
    click BuildCI "https://github.com/syncfusion/maui-toolkit/blob/main/pipelines/build.yml"

    %% Styles
    classDef core fill:#ffcccc,stroke:#cc0000,stroke-width:2px;
    classDef control fill:#ccf5ff,stroke:#0066cc,stroke-width:2px;
    classDef platform fill:#e6ffe6,stroke:#33cc33,stroke-width:2px;
    classDef sample fill:#fff0b3,stroke:#ff6600,stroke-width:2px;
    classDef test fill:#f9e6ff,stroke:#cc33ff,stroke-width:2px;
    classDef build fill:#e6e6ff,stroke:#6666ff,stroke-width:2px;
    classDef config fill:#f2f2f2,stroke:#999999,stroke-width:2px;
```
