Coder Social home page Coder Social logo

wojciechosak / calendar Goto Github PK

View Code? Open in Web Editor NEW
97.0 1.0 5.0 14.28 MB

Kotlin Multiplatform Calendar Library

License: Apache License 2.0

Kotlin 100.00%
android calendar calendar-component calendar-view compose compose-multiplatform composer-library datepicker desktop ios

calendar's Introduction

Compose Multiplatform Calendar

Maven Central

Highly configurable Kotlin Multiplatform Compose library where you can easily draw calendar picker for any platform you want: Android, iOS, Desktop or even Web!

We give you logic, you define UI with Composables!


Features:

Feature Supported
Single month calendar view
Week calendar
Horizontal calendar
Customizable UI
Headers support
Calendar offsets
Single selection
Multiple selection
Month/Year picker
Scroll to date animation
Vertical calendar
Range selection

You can test Web version here: Web Demo It is builded sample app and distributed by Github Pages.


Setup

Maven Central

In Android project:

dependencies {
  implementation 'io.github.wojciechosak:calendar:<latest-version>'
}

In Kotlin Multiplatform project:

commonMain.dependencies {
  implementation 'io.github.wojciechosak:calendar:<latest-version>'
}
HorizontalCalendarView(startDate = startDate) { monthOffset ->
  CalendarView(
    config = rememberCalendarState(
      startDate = startDate,
      monthOffset = 0
    ),
    day = { dayState ->
      // define your day composable here!
    }
  )
}

Basic horizontal scrollable view:

HorizontalCalendarView(startDate = startDate) { monthOffset ->
  CalendarView(
    config = rememberCalendarState(
      startDate = startDate,
      monthOffset = monthOffset,
    ),
  )
}

Documentation

Documentation can be found here: docs.md

Composables

List of available views

Simply use in Compose any view you want:

View type Preview
CalendarView
HorizontalView
VerticalView
WeekView
MonthPicker
YearPicker

Each view get as parameter day cell composable. Thanks to that your calendar can look whatever you like:

Versions

Compose version Library version
1.5.11 0.0.8-compose-1.5.11
1.6.1 0.0.9
1.6.10 1.0.0
1.6.10 1.0.1

Samples:

In directory sample you can find bunch of examples. You can run Android/iOS application and test it yourself. Below you can find instruction how to run sample project on your computer.

Sample project

Before running!

  • check your system with KDoctor
  • install JDK 17 on your machine

Android

To run the application on android device/emulator:

  • open project in Android Studio and run imported android run configuration

To build the application bundle:

  • run ./gradlew :sample:composeApp:assembleDebug
  • find .apk file in sample/composeApp/build/outputs/apk/debug/composeApp-debug.apk

Desktop

Run the desktop application: ./gradlew :sample:composeApp:run

iOS

To run the application on iPhone device/simulator:

  • Open iosApp/iosApp.xcproject in Xcode and run standard configuration
  • In XCode open Build Phases -> Run Script -> paste script:
    cd "$SRCROOT/../../"
    ./gradlew :sample:composeApp:embedAndSignAppleFrameworkForXcode

And build the project.

Browser

Run the browser application: ./gradlew :sample:composeApp:jsBrowserDevelopmentRun

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.